By Date: <-- -->
By Thread: <-- -->

Howto properly get current audio format name?



Hi all,

I'm novice in openh323 library, i need get current audio format name but
i dont known how get him properly. Now i use next code:

char * h323_request_t38(const char *token)
{
        const PString currentToken(token);
        H323Connection * connection;
        PString format="none";
        char formatname[50];

        connection = endPoint->FindConnectionWithLock(currentToken);
        if (!connection) {
                cout << "No connection found for " << token << endl;
                return NULL;
        }

       H323Channel
*ch=connection->FindChannel(RTP_Session::DefaultAudioSessionID, FALSE);

       if (ch) {
          const H323Capability &cap=ch->GetCapability();
          format=cap.GetFormatName();
          memset(formatname,0,50);
          strncpy(formatname,format,( strlen(format) <=
50)?strlen(format):50);
       } else {
          H323Channel
*ch=connection->FindChannel(RTP_Session::DefaultAudioSessionID, TRUE);
          if (ch) {
           const H323Capability &cap=ch->GetCapability();
           format=cap.GetFormatName();
           memset(formatname,0,50);
           strncpy(formatname,format,( strlen(format) <=
50)?strlen(format):50);
         }
      }


        connection->RequestModeChangeT38();
        connection->Unlock();
        return (char *) formatname;
}

But some time i have shit in formatname
(formatname='oigferhugbe89tyh4gfnreioghseiofweio') :) .

Plz help.

Best Regards,
Warp.


------------------------------------------------------------------------
Check the FAQ before asking! - http://www.openh323.org/~openh323/fom.cgi
The OpenH323 Project mailing list, using Mailman. To unsubscribe or
change your subscription options, goto
http://www.openh323.org/mailman/listinfo/openh323
Maintained by Quicknet Technologies, Inc - http://www.quicknet.net
------------------------------------------------------------------------