[asterisk-addons-commits] anthonyl: trunk r290 - /trunk/asterisk-ooh323c/src/chan_h323.c

asterisk-addons-commits at lists.digium.com asterisk-addons-commits at lists.digium.com
Mon Sep 11 10:01:43 MST 2006


Author: anthonyl
Date: Mon Sep 11 12:01:42 2006
New Revision: 290

URL: http://svn.digium.com/view/asterisk-addons?rev=290&view=rev
Log:
7857: VLDMTF for ooh323

Modified:
    trunk/asterisk-ooh323c/src/chan_h323.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=290&r1=289&r2=290&view=diff
==============================================================================
--- trunk/asterisk-ooh323c/src/chan_h323.c (original)
+++ trunk/asterisk-ooh323c/src/chan_h323.c Mon Sep 11 12:01:42 2006
@@ -44,7 +44,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 +55,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 +69,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 +84,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 +647,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 +661,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,7 +674,30 @@
    }
    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;
 }
@@ -2847,20 +2873,40 @@
 
 
 
-static struct ast_rtp *ooh323_get_rtp_peer(struct ast_channel *chan)
-{
-   struct ooh323_pvt *p;
-   p = (struct ooh323_pvt *) chan->tech_pvt;
-
-   if (p && p->rtp) {
-      return p->rtp;
-   }
-   return NULL;
-}
-
-static struct ast_rtp *ooh323_get_vrtp_peer(struct ast_channel *chan)
-{
-   return NULL;
+static enum ast_rtp_get_result ooh323_get_rtp_peer(struct ast_channel *chan, struct ast_rtp **rtp)
+{
+   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->rtp;
+
+   if (!(p->rtp)) {
+	return AST_RTP_GET_FAILED;
+   }
+   res = AST_RTP_TRY_NATIVE;
+
+   return res;
+}
+
+static enum ast_rtp_get_result ooh323_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp **rtp)
+{
+   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 +2988,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);



More information about the asterisk-addons-commits mailing list