| CONTACT | DEVELOPER CENTER | PARTNERS | SITEMAP
GO
Useful Links
  • Search Helpweb
    
    

Dialogic Support Helpweb

Dialogic® Host Media Processing (HMP) Software

Working with the Dialogic® Host Media Processing Software SDAPI Library for Dynamic Payload Types



Problem:
Third party call control becomes more complex with the addition of dynamic payload types introduced by dynamic rate codecs and native hairpinning.  An application needs to take this into account when dealing with this situation.

Reason for the problem:
Unlike static payload types such as G.711, which uses a payload type 0, dynamic payload types can differ per use or per implementation of the SIP endpoint. Dynamic payload types range from 96 through 127. A dynamic codec like Adaptive Multi-Rate (AMR) or H263 uses any number in this range in their invite messages media description sdp entries in the SIP endpoints. Some SIP endpoints provide the ability to assign a constant payload type to each dynamic codec, but given that most Dialogic® applications must work with a variety of endpoints, a better approach for identifying the codec payload type is needed.

Fix / Solution: 

The following approach using the sdpapi library works well when the payload types are fixed or commonly used:

sdpMediaDescription* pMD = sdp.mediaDescriptionList()->getItem(i);
sdpMedia* pMedia = pMD->media();
int NumMedia = pMedia->getNumFormat();
for (j=0;j<NumMedia;j++) {

// Looking for G.711 Nulaw
if (!strcmp(pMedia->getFormat(j),"0")) {
int my_g711Port = pMD->media()->getPort();
}


The above approach will not be able to support a Dialogic® VoIP solution that works with a large number of variable SIP endpoints or dynamic codecs. The following code snippet shows an improved way to work with sdpapi, and to relate the dynamic payload types to a Dialogic® supported code:

sdpMediaDescription* pMD = g_OfferSDP.mediaDescriptionList()->getItem(i);
sdpMedia* pMedia = pMD->media();
//the following gets the video and audio ports from the SDP
if (!strcmp(pMedia->getMedia(),"audio"))
l_audioPort = pMD->media()->getPort();


The first step is to get the port number that the SIP endpoint is requesting to receive the RTP packets for the session on.  The next step is to identify the list of dynamic codecs offered and to locate the information your application needs to provide back to the calling endpoint.

std::string l_propValue;
std::string::size_type l_propAudioSize;
std::string l_payloadAudioType;
std::string l_audioFmtp;

for (j=0;j<NumAttribute;j++) {
sdpAttribute* pAttribute = pAttributeList->getItem(j);
l_propValue = pAttribute->getPropertyValue();

l_propAudioSize = l_propValue.find("amr",0);
if (l_propAudioSize != std::string::npos)
{
if(l_audioPayloadType.empty())
l_audioPayloadType.assign(l_propValue,0,l_propAudioSize);
}


Next, your application will need to get the fmtp information related to the dynamic codec to:
  1. ensure your codec implementation supports the options it defines; and
  2. to echo back the fmtp line in the sdp portion of the SIP OK you send back to the caller.

The following code, used in conjunction with the previous code snippet, provides the information needed.

if ((l_audioPayloadType.size())&&
(l_propValue.find(g_audioPayloadType, 0) != std::string::npos)&&
(l_propAudioSize == std::string::npos))
{
l_audioFmtp.assign(l_propValue);
}


The code snippet above will work for both video and audio codecs and provides one approach for working with dynamic payload types likely to be encountered in next generation VoIP and video applications.

Product List
Dialogic Host Media Processing Software

Glossary of Acronyms / Terms
SDP Session Description Protocol


Feedback

Please rate the usefulness of this page:  

0 - not useful at all
1 - potentially useful
2 - quite useful
3 - very useful
4 - exactly the information I needed     

Please enter a comment about this page: