Index: asterisk-ooh323c/src/chan_h323.c
===================================================================
--- asterisk-ooh323c/src/chan_h323.c	(revision 276)
+++ asterisk-ooh323c/src/chan_h323.c	(working copy)
@@ -59,6 +59,7 @@
 static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, 
                              struct ast_rtp *vrtp, int codecs, int nat_active);
 
+static void print_codec_to_cli(int fd, struct ast_codec_pref *pref);
 static void ast_ooh323c_exit();
 
 
@@ -204,6 +205,7 @@
 static int  gDTMFMode = H323_DTMF_RFC2833;
 static char gGatekeeper[100];
 static enum RasGatekeeperMode gRasGkMode = RasNoGatekeeper;
+static int  gPacketization = 20;
 
 static int  gIsGateway = 0;
 static int  gFastStart = 1;
@@ -412,7 +414,7 @@
  
    ast_rtp_settos(pvt->rtp, gTOS);
 
-
+   /* Set Frame packetization, use default if it doesn't exist. */
    pvt->call_reference = callref;
    if(callToken)
       pvt->callToken = strdup(callToken);
@@ -531,6 +533,8 @@
       p->dtmfmode = peer->dtmfmode;
       strncpy(p->accountcode, peer->accountcode, sizeof(p->accountcode)-1);
       p->amaflags = peer->amaflags;
+
+      /* Set Frame packetization, use default if it doesn't exist. */
    }
    else {
       p->dtmfmode = gDTMFMode;
@@ -946,6 +950,7 @@
       case AST_CONTROL_PROCEEDING:
       case AST_CONTROL_RINGING:
       case AST_CONTROL_PROGRESS:
+      case -1:
          break;
       default:
          ast_log(LOG_WARNING,"Don't know how to indicate condition %d on %s\n",
@@ -1247,6 +1252,7 @@
          p->capability = user->capability;
          memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref));
          p->dtmfmode = user->dtmfmode;
+         /* Set Frame packetization, use default if it doesn't exist. */
          /* Since, call is coming from a pbx user, no need to use gk */
          OO_SETFLAG(p->flags, H323_DISABLEGK);
          OO_SETFLAG(call->flags, OO_M_DISABLEGK);
@@ -2040,8 +2046,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");
@@ -2102,6 +2109,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;
@@ -2129,8 +2154,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");
@@ -2942,6 +2968,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);
Index: asterisk-ooh323c/src/ooh323cDriver.c
===================================================================
--- asterisk-ooh323c/src/ooh323cDriver.c	(revision 276)
+++ asterisk-ooh323c/src/ooh323cDriver.c	(working copy)
@@ -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, 
