Index: asterisk-ooh323c/src/chan_h323.c
===================================================================
--- asterisk-ooh323c/src/chan_h323.c	(revision 287)
+++ asterisk-ooh323c/src/chan_h323.c	(working copy)
@@ -44,7 +45,8 @@
 /* Channel Definition */
 static struct ast_channel *ooh323_request(const char *type, int format, 
                                         void *data, int *cause);
-static int ooh323_digit(struct ast_channel *ast, char digit);
+static int ooh323_digit_begin(struct ast_channel *ast, char digit);
+static int ooh323_digit_end(struct ast_channel *ast, char digit);
 static int ooh323_call(struct ast_channel *ast, char *dest, int timeout);
 static int ooh323_hangup(struct ast_channel *ast);
 static int ooh323_answer(struct ast_channel *ast);
@@ -54,11 +56,12 @@
 static int ooh323_fixup
    (struct ast_channel *oldchan, struct ast_channel *newchan);
 
-static struct ast_rtp *ooh323_get_rtp_peer(struct ast_channel *chan);
-static struct ast_rtp *ooh323_get_vrtp_peer(struct ast_channel *chan);
+static enum ast_rtp_get_result ooh323_get_rtp_peer(struct ast_channel *chan, struct ast_rtp **rtp);
+static enum ast_rtp_get_result ooh323_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp **rtp);
 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();
 
 
@@ -67,7 +70,8 @@
    .description = tdesc,
    .capabilities = -1,
    .requester = ooh323_request,
-   .send_digit = ooh323_digit,
+   .send_digit_begin = ooh323_digit_begin,
+   .send_digit_end = ooh323_digit_end,
    .call = ooh323_call,
    .hangup = ooh323_hangup,
    .answer = ooh323_answer,
@@ -81,10 +85,10 @@
 };
 
 static struct ast_rtp_protocol ooh323_rtp = {
-   .type = type,
-   .get_rtp_info = ooh323_get_rtp_peer,
-   .get_vrtp_info = ooh323_get_vrtp_peer,
-   .set_rtp_peer=  ooh323_set_rtp_peer
+   type: type,
+   get_rtp_info: ooh323_get_rtp_peer,
+   get_vrtp_info: ooh323_get_vrtp_peer,
+   set_rtp_peer: ooh323_set_rtp_peer
 };
 
 /* H.323 channel private structure */
@@ -644,13 +651,13 @@
    return peer;      
 }
 
-static int ooh323_digit(struct ast_channel *chan, char digit)
+static int ooh323_digit_begin(struct ast_channel *chan, char digit)
 {
    char dtmf[2];
    struct ooh323_pvt *p = (struct ooh323_pvt *) chan->tech_pvt;
    
    if(gH323Debug)
-      ast_verbose("---   ooh323_digit\n");
+      ast_verbose("---   ooh323_digit_begin\n");
 
    if(!p){
       ast_log(LOG_ERROR, "No private structure for call\n");
@@ -658,7 +665,7 @@
    }
    ast_mutex_lock(&p->lock);
    if (p->rtp && (p->dtmfmode & H323_DTMF_RFC2833)) {
-      ast_rtp_senddigit(p->rtp, digit);
+      ast_rtp_senddigit_begin(p->rtp, digit);
    }
    else if (((p->dtmfmode & H323_DTMF_Q931) ||
                    (p->dtmfmode & H323_DTMF_H245ALPHANUMERIC) ||
@@ -671,12 +678,35 @@
    }
    ast_mutex_unlock(&p->lock);
    if(gH323Debug)
-      ast_verbose("+++   ooh323_digit\n");
+      ast_verbose("+++   ooh323_digit_begin\n");
 
    return 0;
 }
 
+static int ooh323_digit_end(struct ast_channel *chan, char digit)
+{
+   char dtmf[2];
+   struct ooh323_pvt *p = (struct ooh323_pvt *) chan->tech_pvt;
 
+   if(gH323Debug)
+      ast_verbose("---   ooh323_digit_end\n");
+
+   if(!p){
+      ast_log(LOG_ERROR, "No private structure for call\n");
+      return -1;
+   }
+   ast_mutex_lock(&p->lock);
+   if (p->rtp && (p->dtmfmode & H323_DTMF_RFC2833)) 
+      ast_rtp_senddigit_end(p->rtp, digit);
+
+   ast_mutex_unlock(&p->lock);
+   if(gH323Debug)
+      ast_verbose("+++   ooh323_digit_end\n");
+
+   return 0;
+}
+
+
 static int ooh323_call(struct ast_channel *ast, char *dest, int timeout)
 {
    struct ooh323_pvt *p = ast->tech_pvt;
@@ -2847,20 +2899,40 @@
 
 
 
-static struct ast_rtp *ooh323_get_rtp_peer(struct ast_channel *chan)
+static enum ast_rtp_get_result ooh323_get_rtp_peer(struct ast_channel *chan, struct ast_rtp **rtp)
 {
-   struct ooh323_pvt *p;
-   p = (struct ooh323_pvt *) chan->tech_pvt;
+   struct ooh323_pvt *p = NULL;
+   enum ast_rtp_get_result res = AST_RTP_TRY_PARTIAL;
 
-   if (p && p->rtp) {
-      return p->rtp;
+   if (!(p = (struct ooh323_pvt *) chan->tech_pvt))
+	return AST_RTP_GET_FAILED;
+
+   *rtp = p->rtp;
+
+   if (!(p->rtp)) {
+	return AST_RTP_GET_FAILED;
    }
-   return NULL;
+   res = AST_RTP_TRY_NATIVE;
+
+   return res;
 }
 
-static struct ast_rtp *ooh323_get_vrtp_peer(struct ast_channel *chan)
+static enum ast_rtp_get_result ooh323_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp **rtp)
 {
-   return NULL;
+   struct ooh323_pvt *p = NULL;
+   enum ast_rtp_get_result res = AST_RTP_TRY_PARTIAL;
+
+   if (!(p = (struct ooh323_pvt *) chan->tech_pvt))
+        return AST_RTP_GET_FAILED;
+
+   *rtp = p->vrtp;
+
+   if (!(p->rtp)) {
+        return AST_RTP_GET_FAILED;
+   }
+   res = AST_RTP_TRY_NATIVE;
+
+   return res;
 }
 
 
@@ -2942,6 +3014,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);
