Quantcast
Channel: Dialogic PowerMedia HMP GlobalCall and R4 API - Recent Threads
Viewing all articles
Browse latest Browse all 1151

RE: SIP: How to set default codecs for OPTIONS response

$
0
0

Yes that output is what we get when we let the GC library to handle OPTIONS request. As soon as we switch the handling to our custom implementation we get this

Device: [DEVICE: iptB1]gcValue: 44; gcMsg: Invalid parameter; ccLibId: 8; ccLibN

ame: GC_H3R_LIB; ccValue: 5; ccMsg: IPERR_BAD_PARAM; additionalInfo:

So here is how we do it and so far we just try to simulate the default output but from custom implementation.

If you see anything suspicious please let us know.

Best Regards.

IP_VIRTBOARD virtBoards[1];

/* Other code */

virtBoards[0].E_SIP_OPTIONS_Access = ENUM_Enabled;

Then in the device event handler function:

Approach 1 - setup IP_CAPABILITY

GC_PARM_BLKP paramBlock = NULL;

IP_CAPABILITY *txCap = new IP_CAPABILITY;

ZeroMemory(txCap, sizeof(IP_CAPABILITY));

txCap->capability = CODEC_AUDIO_G711ALAW64K;

txCap->direction = IP_CAP_DIR_LCLTRANSMIT;

txCap->type = GCCAPTYPE_AUDIO;

txCap->extra.audio.frames_per_pkt = 20;

txCap->extra.audio.VAD = GCPV_DISABLE;

IP_CAPABILITY *rxCap = new IP_CAPABILITY;

ZeroMemory(rxCap, sizeof(IP_CAPABILITY));

rxCap->capability = CODEC_AUDIO_G711ALAW64K;

rxCap->direction = IP_CAP_DIR_LCLTRANSMIT;

rxCap->type = GCCAPTYPE_AUDIO;

rxCap->extra.audio.frames_per_pkt = 20;

rxCap->extra.audio.VAD = GCPV_DISABLE;

gc_util_insert_parm_ref_ex(&paramBlock,

GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), txCap); // Push txCap to paramBlock

gc_util_insert_parm_ref_ex(&paramBlock,

GCSET_CHAN_CAPABILITY, IPPARM_LOCAL_CAPABILITY, sizeof(IP_CAPABILITY), rxCap); // Push rxCap to paramBlock

/* Other code */

GC_PARM_BLKP retParamBlock = NULL;

gc_Extension(GCTGT_GCLIB_CHAN, 1, IPEXTID_SENDMSG, paramBlock, &retParamBlock, EV_ASYNC); // <- Here is where error is being raised

Approach 2 - Just write the same response as in the default handler by setting MIME_PART parameters.

// #.#.#.# - valid local IP

const char* optBody = "v=0\n\

o=Dialogic_SIP_CCLIB 0 1 IN IP4 #.#.#.#\n\

s=Dialogic_SIP_CCLIB\n\

i=session information\n\

c=IN IP4 #.#.#.#\n\

t=0 0\n\

m=audio 49152 RTP/AVP 8\n\

a=ptime:20";

const char* typeString = "Content-Type: application/sdp";

gc_util_insert_parm_ref_ex(&mimeBlock, IPSET_MIME, IPPARM_MIME_PART_TYPE, (unsigned long)strlen(typeString) + 1, (char *)typeString);

gc_util_insert_parm_val(&mimeBlock, IPSET_MIME, IPPARM_MIME_PART_BODY_SIZE, sizeof(unsigned long), strlen(optBody));

gc_util_insert_parm_val(&mimeBlock, IPSET_MIME, IPPARM_MIME_PART_BODY, sizeof(unsigned long), (unsigned long)optBody);

gc_util_insert_parm_val(&paramBlock, IPSET_MIME, IPPARM_MIME_PART, sizeof(unsigned long), (unsigned long)mimeBlock);

/* Other code */

GC_PARM_BLKP retParamBlock = NULL;

gc_Extension(GCTGT_GCLIB_CHAN, 1, IPEXTID_SENDMSG, paramBlock, &retParamBlock, EV_ASYNC); // <- Here is where error is being raised


Viewing all articles
Browse latest Browse all 1151

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>