]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
added UU transceiving and corect handling for rdnis
authorChristian Richter <christian.richter@beronet.com>
Mon, 12 Mar 2007 12:43:24 +0000 (12:43 +0000)
committerChristian Richter <christian.richter@beronet.com>
Mon, 12 Mar 2007 12:43:24 +0000 (12:43 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@58825 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_misdn.c
channels/misdn/ie.c
channels/misdn/isdn_lib.c
channels/misdn/isdn_lib.h
channels/misdn/isdn_msg_parser.c

index bf2149cc056e590c025766bc050db90cb0289673..c76facee5b8591fa7e6c30014623d3b2aa2d50ef 100644 (file)
@@ -1947,7 +1947,12 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
                strncpy(newbc->dad,ast->exten, l);
                newbc->dad[l-1] = 0;
        }
-       newbc->rad[0]=0;
+
+       if (ast->cid.cid_rdnis)  
+               strcpy(newbc->rad, ast->cid.cid_rdnis);
+       else 
+               newbc->rad[0]=0;
+
        chan_misdn_log(3, port, " --> * adding2newbc callerid %s\n",AST_CID_P(ast));
        if (ast_strlen_zero(newbc->oad) && AST_CID_P(ast) ) {
 
@@ -3581,6 +3586,15 @@ void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_
        if (tmp && (atoi(tmp) == 1)) {
                bc->sending_complete=1;
        }
+       
+       ast_log(LOG_VERBOSE, "getting MISDN_USERUSER:\n");
+       tmp=pbx_builtin_getvar_helper(chan,"MISDN_USERUSER");
+       if (tmp) {
+               ast_log(LOG_VERBOSE, "MISDN_USERUSER: %s\n", tmp);
+               strcpy(bc->uu, tmp);
+               bc->uulen=strlen(bc->uu);
+       }
+
 }
 
 void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)
@@ -3599,6 +3613,10 @@ void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_
                sprintf(tmp,"%d",bc->urate);
                pbx_builtin_setvar_helper(chan,"MISDN_URATE",tmp);
        }
+
+       if (bc->uulen) {
+               pbx_builtin_setvar_helper(chan,"MISDN_USERUSER",bc->uu);
+       }
 }
 
 int add_in_calls(int port)
index af2d14019e593df7c585cf264c35521d6f24e085..3fbccab3ea28750ca55015a3e4083237adb32ed1 100644 (file)
@@ -1324,7 +1324,7 @@ static void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *p
 
 
 /* IE_USERUSER */
-#if 0
+#if 1
 static void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, char *user, int user_len, int nt, struct misdn_bchannel *bc)
 {
        unsigned char *p;
@@ -1366,7 +1366,7 @@ static void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, ch
 }
 #endif
 
-#if 0
+#if 1
 static void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, char *user, int *user_len, int nt, struct misdn_bchannel *bc)
 {
        char debug[768];
index f745e8bcbe92181e5a8b79d23f3e3648146f34b6..8f587e5d007f17ec7289eded98e0d97bab6d1c91 100644 (file)
@@ -617,6 +617,8 @@ static void empty_bc(struct misdn_bchannel *bc)
        bc->dad[0] = 0;
        bc->rad[0] = 0;
        bc->orig_dad[0] = 0;
+       bc->uu[0]=0;
+       bc->uulen=0;
        
        bc->fac_in.Function = Fac_None;
        bc->fac_out.Function = Fac_None;
@@ -3086,6 +3088,9 @@ struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel, int inout)
                        }
 
                        int maxnum=inout&&!stack->pri&&!stack->ptp?stack->b_num+1:stack->b_num;
+                       //int maxnum=stack->b_num+1;
+
+                       cb_log(0,0,"maxnum:%d",maxnum);
                        for (i = 0; i <maxnum; i++) {
                                if (!stack->bc[i].in_use) {
                                        /* 3. channel on bri means CW*/
index e320882ddef7db50ce10cb88b82c8762265d64d8..cc2ea45b82bf23c54d740cf32028623cba8203d1 100644 (file)
@@ -334,7 +334,9 @@ struct misdn_bchannel {
 /*     unsigned char info_keypad[32]; */
 /*     unsigned char clisub[24]; */
 /*     unsigned char cldsub[24]; */
-/*     unsigned char uu[256]; */
+
+       char uu[256];
+       int uulen;
   
        int cause;
        int out_cause;
index 1a1223db78cd1344a1672ebbd6cbd39b3f6d6510..66e68b2ac2b886408a7165d357adfea0f41b2172 100644 (file)
@@ -252,6 +252,14 @@ static void parse_setup (struct isdn_msg msgs[], msg_t *msg, struct misdn_bchann
                
                set_channel(bc,channel);
        }
+
+       {
+               int  protocol ;
+               dec_ie_useruser(setup->USER_USER, (Q931_info_t *)setup, &protocol, bc->uu, &bc->uulen, nt,bc);
+               if (bc->uulen) cb_log(1,bc->port,"USERUESRINFO:%s\n",bc->uu);
+               else
+               cb_log(1,bc->port,"NO USERUESRINFO\n");
+       }
        
        dec_ie_progress(setup->PROGRESS, (Q931_info_t *)setup, &bc->progress_coding, &bc->progress_location, &bc->progress_indicator, nt, bc);
        
@@ -331,6 +339,14 @@ static msg_t *build_setup (struct isdn_msg msgs[], struct misdn_bchannel *bc, in
                enc_ie_complete(&setup->BEARER,msg, bc->sending_complete, nt, bc);
        }
   
+       {
+               int  protocol=4;
+               enc_ie_useruser(&setup->USER_USER, msg, protocol, bc->uu, bc->uulen, nt,bc);
+               if (bc->uulen) cb_log(1,bc->port,"ENCODING USERUESRINFO:%s\n",bc->uu);
+               else
+               cb_log(1,bc->port,"NO USERUESRINFO ENCODED\n");
+       }
+
 #if DEBUG 
        printf("Building SETUP Msg\n"); 
 #endif