[Asterisk-cvs] asterisk-addons/asterisk-ooh323c/src chan_h323.c, 1.10, 1.11

vphirke vphirke
Mon Sep 26 09:05:35 CDT 2005


Update of /usr/cvsroot/asterisk-addons/asterisk-ooh323c/src
In directory mongoose.digium.com:/tmp/cvs-serv19944/asterisk-ooh323c/src

Modified Files:
	chan_h323.c 
Log Message:
Updated

Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/asterisk-ooh323c/src/chan_h323.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- chan_h323.c	16 Sep 2005 19:29:17 -0000	1.10
+++ chan_h323.c	26 Sep 2005 13:02:28 -0000	1.11
@@ -105,6 +105,7 @@
    char *host;
    char *callerid_name;
    char *callerid_num;
+   char *called_num;
    char caller_h323id[AST_MAX_EXTENSION];
    char caller_dialedDigits[AST_MAX_EXTENSION];
    char caller_email[AST_MAX_EXTENSION];
@@ -305,21 +306,34 @@
          ch->cid.cid_name = strdup(i->callerid_name);
       }
       if(i->callerid_num){
+
          ch->cid.cid_num = strdup(i->callerid_num);
       }
 
-      if (!ast_strlen_zero(i->caller_h323id)) {
-         pbx_builtin_setvar_helper(ch, "_CALLER_H323ID", i->caller_h323id);
+      if(!ast_test_flag(i, H323_OUTGOING))
+      {
+         if (!ast_strlen_zero(i->exten)) {
+            /* If exten is not default extension "s", then only store it as 
+               called extension. This called extension can be used later on 
+               as called number ie in outgoing call.
+	    */
+            if(strcmp(i->exten, "s"))
+               pbx_builtin_setvar_helper(ch, "_CALLED_EXTEN", i->exten);
+         }
+      
+         if (!ast_strlen_zero(i->caller_h323id)) {
+            pbx_builtin_setvar_helper(ch, "_CALLER_H323ID", i->caller_h323id);
 
-      }
-      if (!ast_strlen_zero(i->caller_dialedDigits)) {
-         pbx_builtin_setvar_helper(ch, "_CALLER_H323DIALEDDIGITS", i->caller_dialedDigits);
-      }
-      if (!ast_strlen_zero(i->caller_email)) {
-         pbx_builtin_setvar_helper(ch, "_CALLER_H323EMAIL", i->caller_email);
-      }
-      if (!ast_strlen_zero(i->caller_url)) {
-         pbx_builtin_setvar_helper(ch, "_CALLER_H323URL", i->caller_url);
+         }
+         if (!ast_strlen_zero(i->caller_dialedDigits)) {
+            pbx_builtin_setvar_helper(ch, "_CALLER_H323DIALEDDIGITS", i->caller_dialedDigits);
+         }
+         if (!ast_strlen_zero(i->caller_email)) {
+            pbx_builtin_setvar_helper(ch, "_CALLER_H323EMAIL", i->caller_email);
+         }
+         if (!ast_strlen_zero(i->caller_url)) {
+            pbx_builtin_setvar_helper(ch, "_CALLER_H323URL", i->caller_url);
+         }
       }
 	
       if (!ast_strlen_zero(i->accountcode)){
@@ -481,6 +495,10 @@
    }
    ast_mutex_lock(&p->lock);
 
+   /* This is an outgoing call, since h323_request is called */
+   ast_set_flag(p, H323_OUTGOING);
+
+
    strncpy(tmp, (char*)data, sizeof(tmp)-1);
 
    dest = strchr(tmp, '/');
@@ -696,6 +714,7 @@
      if(p->callerid_num)   free(p->callerid_num);
       p->callerid_num = strdup(ast->cid.cid_num);
    }
+
    if(ast->cid.cid_name) {
       if(p->callerid_name)   free(p->callerid_name);
       p->callerid_name = strdup(ast->cid.cid_name);
@@ -706,6 +725,11 @@
    }
 
    /* Retrieve vars */
+
+   val = pbx_builtin_getvar_helper(ast, "_CALLED_EXTEN");
+   if(val)
+     p->called_num = strdup(val);
+
    val = pbx_builtin_getvar_helper(ast, "CALLER_H323ID");
    if(val){
      strncpy(p->caller_h323id, val, sizeof(p->caller_h323id)-1);
@@ -713,7 +737,9 @@
    
    val = pbx_builtin_getvar_helper(ast, "CALLER_H323DIALEDDIGITS");
    if(val){
-     strncpy(p->caller_dialedDigits, val, sizeof(p->caller_dialedDigits)-1);
+      strncpy(p->caller_dialedDigits, val, sizeof(p->caller_dialedDigits)-1);
+      if(!p->callerid_num)   p->callerid_num = strdup(val);
+     
    }
 
    val = pbx_builtin_getvar_helper(ast, "CALLER_H323EMAIL");
@@ -1356,10 +1382,14 @@
       
       if(!ast_strlen_zero(p->caller_h323id))
          ooCallAddAliasH323ID(call, p->caller_h323id);
+
       if(!ast_strlen_zero(p->caller_dialedDigits)){
          ooCallAddAliasDialedDigits(call, p->caller_dialedDigits);
+      }else if(p->callerid_num) {
+         ooCallAddAliasDialedDigits(call, p->callerid_num);
       }
   
+
      if(!ast_strlen_zero(p->exten))  
      {
          for(i=0; *(p->exten+i) != '\0'; i++)
@@ -1373,6 +1403,8 @@
          }
          else
            ooCallAddRemoteAliasH323ID(call, p->exten);
+     }else if(p->called_num){
+        ooCallSetCalledPartyNumber(call, p->called_num);
      }
 
      if(gH323Debug)
@@ -2597,6 +2629,9 @@
       if(cur->callerid_num)
          free(cur->callerid_num);
 
+      if(cur->called_num)
+         free(cur->called_num);
+
 
        if (cur->rtp)
           ast_rtp_destroy(cur->rtp);




More information about the svn-commits mailing list