Hi again. I have been trying to send an out of session SIP message as you described using this code:
bool success = false;
GC_PARM_BLKP parameterBlock = nullptr;
GC_PARM_BLKP mimeBlock = nullptr;
GC_PARM_BLKP returnBlock = nullptr;
char *contentType = "Content-Type: text/plain";
char *messageBody = "Message body goes here";
char *userAgent = "User-Agent: VoiceGuideHMP";
std::ostringstream contactUriSS;
contactUriSS << "Contact: <sip:" << contactUri << ">;methods=\"INVITE, INFO, MESSAGE, SUBSCRIBE, BYE, CANCEL, NOTIFY, ACK, REFER\"";
const std::string formattedContactUri = contactUriSS.str();
if (gc_util_insert_parm_val(¶meterBlock, IPSET_MSG_SIP, IPPARM_MSGTYPE, sizeof(int), IP_MSGTYPE_SIP_MESSAGE) < 0 ||
gc_util_insert_parm_ref_ex(¶meterBlock, IPSET_SIP_MSGINFO, IPPARM_REQUEST_URI, static_cast<unsigned long>(formattedContactUri.length() + 1), const_cast<char *>(formattedContactUri.c_str())) < 0 ||
gc_util_insert_parm_ref(¶meterBlock, IPSET_SIP_MSGINFO, IPPARM_SIP_HDR, (strlen(userAgent) + 1), userAgent) < 0 ||
gc_util_insert_parm_ref_ex(&mimeBlock, IPSET_MIME, IPPARM_MIME_PART_TYPE, static_cast<unsigned long>(strlen(contentType)) + 1, contentType) < 0 ||
gc_util_insert_parm_val(&mimeBlock, IPSET_MIME, IPPARM_MIME_PART_BODY_SIZE, sizeof(unsigned long), strlen(messageBody)) < 0 ||
gc_util_insert_parm_val(&mimeBlock, IPSET_MIME, IPPARM_MIME_PART_BODY, sizeof(unsigned long), reinterpret_cast<unsigned long>(messageBody)) < 0 ||
gc_util_insert_parm_val(¶meterBlock, IPSET_MIME, IPPARM_MIME_PART, sizeof(unsigned long), reinterpret_cast<unsigned long>(mimeBlock)) < 0)
{
// log error
}
else if (gc_Extension(GCTGT_GCLIB_CHAN, ldid, IPEXTID_SENDMSG, parameterBlock, &returnBlock, EV_ASYNC) != GC_SUCCESS)
{
// log error
}
else
{
success = true;
}
if (mimeBlock != nullptr) gc_util_delete_parm_blk(mimeBlock);
if (parameterBlock != nullptr) gc_util_delete_parm_blk(parameterBlock);
if (returnBlock != nullptr) gc_util_delete_parm_blk(returnBlock);
return success;
However this is failing when gc_Extension() is called. I retrieve error info and am logging this:
[2016-03-01 11:08:06] (0x00000d50) [Err] gc_Extension() failed in Extension_SipMessage() with LDID 3
[2016-03-01 11:08:06] (0x00000d50) [Err] gc_ErrorInfo() results - GCValue: 68, GCMessage Invalid parameter, CCLibID: 8, CCLibName: GC_H3R_LIB, CCLibValue: 48, CCLibMessage: IPERR_INVALID_ID.
In the Dialogic RTF logs I see this:
03/01/2016 10:52:56.738 8784 12824 gc APPL gclib <:::: gc_Extension(target_type:12, target_id:40, exit_id:1, mode:async)
03/01/2016 10:52:56.738 8784 12824 gc_h3r SH_UNP..ER DEBG unpack.cpp:1339 ! 0 ! >> Unpack::reqExtension : pIptDevice=0x5a9cf98,hCrn=0,extId=1,pInfoParmBlk=0x65ea498,pRetParmBlk=0x6edade8
03/01/2016 10:52:56.738 8784 12824 gc_h3r ERR1 unpack.cpp:1364 ! 0 ! << Unpack::reqExtension : [48] - hCrn=0 is invalid
03/01/2016 10:52:56.738 8784 12824 gc_h3r WARN sm_callcontrol.:1196 ! 0 ! << Extension:reqExtension failed
03/01/2016 10:52:56.738 8784 12824 gc ERR1 gclib iptB1T19 ::::> gc_Extension(target_type:12, target_id:40, exit_id:1, mode:async) - returns:-1
03/01/2016 10:52:56.738 8784 12824 gc_h3r SH_MGR DEBG sm_error.cpp:198 ! 0 ! ShmErrorValue leaving OK...
I am wondering what I am doing wrong that would mean it was saying "hCrn=0 is invalid" when I am specifying GCTGT_GCLIB_CHAN.
Do you see any issues with my code? Should I be using IPPARAM_CONTACT_URI rather then IPPARAM_REQUEST_URI?
Thanks