[asterisk-addons-commits] qwell: trunk r296 - in /trunk/asterisk-ooh323c/src: chan_h323.c ooh323cDriver.c

asterisk-addons-commits at lists.digium.com asterisk-addons-commits at lists.digium.com
Wed Sep 20 14:16:37 MST 2006


Author: qwell
Date: Wed Sep 20 16:16:37 2006
New Revision: 296

URL: http://svn.digium.com/view/asterisk-addons?rev=296&view=rev
Log:
chan_ooh323 packetization.

Issue #5588, patch by DEA.

Modified:
    trunk/asterisk-ooh323c/src/chan_h323.c
    trunk/asterisk-ooh323c/src/ooh323cDriver.c

Modified: trunk/asterisk-ooh323c/src/chan_h323.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/asterisk-ooh323c/src/chan_h323.c?rev=296&r1=295&r2=296&view=diff
==============================================================================
--- trunk/asterisk-ooh323c/src/chan_h323.c (original)
+++ trunk/asterisk-ooh323c/src/chan_h323.c Wed Sep 20 16:16:37 2006
@@ -2068,8 +2068,9 @@
    {
       sprintf(ip_port, "%s:%d", peer->ip, peer->port);
       ast_cli(fd, "%-15.15s%s\n", "Name: ", peer->name);
-      ast_codec_pref_string(&peer->prefs, formats, 512);
-      ast_cli(fd, "%-15.15s%s\n", "Format Prefs: ", formats);
+      ast_cli(fd, "%-15.15s%s", "Format Prefs: ", "(");
+      print_codec_to_cli(fd, &peer->prefs);
+      ast_cli(fd, ")\n");
       ast_cli(fd, "%-15.15s", "DTMF Mode: ");
       if(peer->dtmfmode & H323_DTMF_RFC2833)
          ast_cli(fd, "%s\n", "rfc2833");
@@ -2130,6 +2131,24 @@
    return RESULT_SUCCESS;
 }
 
+/*! \brief Print codec list from preference to CLI/manager */
+static void print_codec_to_cli(int fd, struct ast_codec_pref *pref)
+{
+	int x, codec;
+
+	for(x = 0; x < 32 ; x++) {
+		codec = ast_codec_pref_index(pref, x);
+		if (!codec)
+			break;
+		ast_cli(fd, "%s", ast_getformatname(codec));
+		ast_cli(fd, ":%d", pref->framing[x]);
+		if (x < 31 && ast_codec_pref_index(pref, x + 1))
+			ast_cli(fd, ",");
+		}
+	if (!x)
+		ast_cli(fd, "none");
+}
+
 static int ooh323_show_user(int fd, int argc, char *argv[])
 {
    struct ooh323_user *prev=NULL, *user=NULL;
@@ -2157,8 +2176,9 @@
    if(user)
    {
       ast_cli(fd, "%-15.15s%s\n", "Name: ", user->name);
-      ast_codec_pref_string(&user->prefs, formats, 512);
-      ast_cli(fd, "%-15.15s%s\n", "Format Prefs: ",formats);
+      ast_cli(fd, "%-15.15s%s", "Format Prefs: ", "(");
+      print_codec_to_cli(fd, &user->prefs);
+      ast_cli(fd, ")\n");
       ast_cli(fd, "%-15.15s", "DTMF Mode: ");
       if(user->dtmfmode & H323_DTMF_RFC2833)
          ast_cli(fd, "%s\n", "rfc2833");
@@ -2990,6 +3010,9 @@
    if(gH323Debug)
       ast_verbose("---   configure_local_rtp\n");
 
+   if (p->rtp){
+	ast_rtp_codec_setpref(p->rtp, &p->prefs);
+   }
 
    /* figure out our local RTP port and tell the H.323 stack about it*/
    ast_rtp_get_us(p->rtp, &us);

Modified: trunk/asterisk-ooh323c/src/ooh323cDriver.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/asterisk-ooh323c/src/ooh323cDriver.c?rev=296&r1=295&r2=296&view=diff
==============================================================================
--- trunk/asterisk-ooh323c/src/ooh323cDriver.c (original)
+++ trunk/asterisk-ooh323c/src/ooh323cDriver.c Wed Sep 20 16:16:37 2006
@@ -147,7 +147,7 @@
 int ooh323c_set_capability_for_call
    (ooCallData *call, struct ast_codec_pref *prefs, int capability, int dtmf)
 {
-   int ret, x;
+   int ret, x, txframes, rxframes;
    int format=0;
    if(gH323Debug)
      ast_verbose("\tAdding capabilities to call(%s, %s)\n", call->callType, 
@@ -167,7 +167,8 @@
          if(gH323Debug)
             ast_verbose("\tAdding g711 ulaw capability to call(%s, %s)\n", 
                                               call->callType, call->callToken);
-         ret= ooCallAddG711Capability(call, OO_G711ULAW64K, gtxframes, 
+	 txframes = prefs->framing[x];
+         ret= ooCallAddG711Capability(call, OO_G711ULAW64K, txframes, 
                                       grxframes, OORXANDTX, 
                                       &ooh323c_start_receive_channel,
                                       &ooh323c_start_transmit_channel,
@@ -179,8 +180,9 @@
          if(gH323Debug)
             ast_verbose("\tAdding g711 alaw capability to call(%s, %s)\n",
                                             call->callType, call->callToken);
-         ret= ooCallAddG711Capability(call, OO_G711ALAW64K, gtxframes, 
-                                      grxframes, OORXANDTX, 
+         txframes = prefs->framing[x];
+         ret= ooCallAddG711Capability(call, OO_G711ALAW64K, txframes, 
+                                     grxframes, OORXANDTX, 
                                      &ooh323c_start_receive_channel,
                                      &ooh323c_start_transmit_channel,
                                      &ooh323c_stop_receive_channel, 
@@ -192,7 +194,8 @@
          if(gH323Debug)
             ast_verbose("\tAdding g729A capability to call(%s, %s)\n",
                                             call->callType, call->callToken);
-         ret= ooCallAddG729Capability(call, OO_G729A, 6, 24, 
+         txframes = (prefs->framing[x])/10;
+         ret= ooCallAddG729Capability(call, OO_G729A, txframes, 24, 
                                      OORXANDTX, &ooh323c_start_receive_channel,
                                      &ooh323c_start_transmit_channel,
                                      &ooh323c_stop_receive_channel, 
@@ -201,7 +204,7 @@
          if(gH323Debug)
             ast_verbose("\tAdding g729 capability to call(%s, %s)\n",
                                             call->callType, call->callToken);
-         ret|= ooCallAddG729Capability(call, OO_G729, 6, 24, 
+         ret|= ooCallAddG729Capability(call, OO_G729, txframes, 24, 
                                      OORXANDTX, &ooh323c_start_receive_channel,
                                      &ooh323c_start_transmit_channel,
                                      &ooh323c_stop_receive_channel, 



More information about the asterisk-addons-commits mailing list