Yu.Ding 1 هفته پیش
والد
کامیت
9ae89e744f
5فایلهای تغییر یافته به همراه124 افزوده شده و 25 حذف شده
  1. 6 6
      generate_extension_conf.c
  2. 1 0
      generate_group_conf.c
  3. 1 0
      generate_group_conf_acorp.c
  4. 112 15
      generate_trunk_conf.c
  5. 4 4
      generate_user_conf.c

+ 6 - 6
generate_extension_conf.c

@@ -154,10 +154,8 @@ while ((g_row=mysql_fetch_row(g_res))){ // 打印结果集
     }
     fprintf(conf_ivr_fp,"\
 [voicemenu-custom-%s]\n\
-include => %s\n\
 exten => %s,1,NoOp(%s)\n",\
 g_row[1],\
-g_row[6],\
 g_row[1],\
 g_row[0]\
     );
@@ -194,7 +192,7 @@ same => n,WaitExten(1)\n");
                     fprintf(conf_ivr_fp,"exten => %s,1,Hangup()\n",keysObject[i].key);
                 }
                 else if(strcmp(keysObject[i].type, "extension") == 0){
-                    fprintf(conf_ivr_fp,"exten => %s,1,Goto(default,%s,1)\n",keysObject[i].key,keysObject[i].exten);
+                    fprintf(conf_ivr_fp,"exten => %s,1,Gosub(stdexten,s,1(%s,PJSIP/%s))\n",keysObject[i].key,keysObject[i].exten,keysObject[i].exten);
                 }
                 else if(strcmp(keysObject[i].type, "ivr") == 0){
                     fprintf(conf_ivr_fp,"exten => %s,1,Goto(voicemenu-custom-%s,%s,1)\n",keysObject[i].key,keysObject[i].exten,keysObject[i].exten);
@@ -406,9 +404,11 @@ exten => direct,1,Hangup()\n"
             else if(strcmp(cJSON_GetObjectItem(pJson, "type")->valuestring, "extension") == 0){
                 sprintf(inboundstr,"\
 [direct-analog]\n\
-exten => direct,1,Goto(default,%s,1)\n\
+exten => direct,1,Gosub(stdexten,s,1(%s,PJSIP/%s))\n\
 [direct-voip]\n\
-exten => direct,1,Goto(default,%s,1)\n",\
+exten => direct,1,Gosub(stdexten,s,1(%s,PJSIP/%s))\n",\
+cJSON_GetObjectItem(pJson, "exten")->valuestring,\
+cJSON_GetObjectItem(pJson, "exten")->valuestring,\
 cJSON_GetObjectItem(pJson, "exten")->valuestring,\
 cJSON_GetObjectItem(pJson, "exten")->valuestring\
     );
@@ -595,7 +595,7 @@ PAGING_AUTO = yes\n\
             pJson = cJSON_Parse(g_row[2]);
             fprintf(conf_calltrigger_fp, "\
 exten => _%s.,1,Gosub(calltrigger,s,1(${EXTEN}))\n\
-exten => _%s.,1,Gusub(calltrigger,s,1(${EXTEN}))\n\
+exten => _%s.,1,Gosub(calltrigger,s,1(${EXTEN}))\n\
 ",\
 cJSON_GetObjectItem(pJson, "start")->valuestring,\
 cJSON_GetObjectItem(pJson, "stop")->valuestring\

+ 1 - 0
generate_group_conf.c

@@ -255,6 +255,7 @@ while ((g_row=mysql_fetch_row(g_res))){ // 打印结果集
     
     fprintf(conf_paging_fp, "\
 [paging-group-%s]\n\
+include => cdr-action\n\
 exten => %s,1,NoOp(%s)\n\
 same => n,MSet(__SRCEXTEN=${CALLERID(num)},__DESTS=%s,DATE=${STRFTIME(${EPOCH},,%%Y%%m%%d)},__UUID=${UNIQUEID},__VOLSTR=%s)\n\
 same => n,GotoIf($[\"foo${PAGING_RECORD}\" != \"fooyes\"]?unrc)\n\

+ 1 - 0
generate_group_conf_acorp.c

@@ -228,6 +228,7 @@ same => n,MSet(startT=${STRFTIME(${EPOCH},,%%s)},__CALLEE=${DESTS},__calltype=pa
 same => n,MSet(CONFBRIDGE(user,quiet)=yes,CONFBRIDGE(user,marked)=yes)\n\
 same => n,AGI(agi://${AGISERVERHOST}:${AGISERVERPORT},alarmCall,${CONFNO},${SRCEXTEN},${DESTS})\n\
 same => n,UserEvent(controlEvent,sessionlevel:${SESSION_LEVEL},sessionuserid:${SESSION_USERID},src:${SRCEXTEN},dest:,uuid:${UUID},status:Answered)\n\
+same => n,Set(GLOBAL(ACTION_${CONFNO})=ON)\n\
 same => n,ConfBridge(${CONFNO})\n\
 same => n,Hangup\n\
 exten => h,1,Goto(checkmeetme,s,1)\

+ 112 - 15
generate_trunk_conf.c

@@ -294,7 +294,10 @@ fromuser,fromdomain,contact,voipsecret,qualify,qualifyfreq,transport,context,\
         strcpy(trunkObject[trunk_size].qualifyfreq, g_row[13]);
         strcpy(trunkObject[trunk_size].transport, g_row[14]);
         strcpy(trunkObject[trunk_size].context, g_row[15]);
-        strcpy(trunkObject[trunk_size].dtmfmode, g_row[16]);
+        if(strcmp(g_row[16],"rfc2833") == 0)
+            strcpy(trunkObject[trunk_size].dtmfmode, "rfc4733");
+        else
+            strcpy(trunkObject[trunk_size].dtmfmode, g_row[16]);
         strcpy(trunkObject[trunk_size].videosupport, g_row[17]);
         strcpy(trunkObject[trunk_size].encryption, g_row[18]);
         strcpy(trunkObject[trunk_size].srtpcapable, g_row[19]);
@@ -493,13 +496,15 @@ mytime()\
 
     while(i < trunk_size){
         if(strcmp(trunkObject[i].trunkactive, "yes") == 0){
-            if(strcmp(trunkObject[i].trunkstyle, "Peer") != 0 && strlen(trunkObject[i].voipusername) > 0)
+            if(strcmp(trunkObject[i].trunkstyle, "Peer") != 0)
             {
-                fprintf(conf_trunk_regs, "\
+                if(strlen(trunkObject[i].voipusername) > 0)
+                {
+                    fprintf(conf_trunk_regs, "\
 [%s]\n\
 type = registration\n\
 transport = transport-%s\n\
-outbound_auth = %s_auth\n\
+outbound_auth = auth_%s\n\
 server_uri = sip:%s:%s\n\
 client_uri = sip:%s@%s\n\
 contact_user = %s\n\
@@ -521,8 +526,8 @@ trunkObject[i].contact,\
 trunkObject[i].outbound_proxy,\
 trunkObject[i].trunk\
 );
-                fprintf(conf_trunk_auths, "\
-[%s_auth]\n\
+                    fprintf(conf_trunk_auths, "\
+[auth_%s]\n\
 type = auth\n\
 auth_type = userpass\n\
 password = %s\n\
@@ -532,7 +537,7 @@ trunkObject[i].trunk,\
 trunkObject[i].voipsecret,\
 trunkObject[i].authuser\
 );
-                fprintf(conf_trunk_eps, "\
+                    fprintf(conf_trunk_eps, "\
 [%s]\n\
 type = endpoint\n\
 transport = transport-%s\n\
@@ -549,7 +554,7 @@ dtmf_mode = %s\n\
 force_rport = no\n\
 ice_support = no\n\
 identify_by = %s\n\
-outbound_auth = %s_auth\n\
+outbound_auth = auth_%s\n\
 outbound_proxy = %s\n\
 rewrite_contact = no\n\
 rtp_symmetric = no\n\
@@ -590,7 +595,97 @@ trunkObject[i].outbound_proxy,\
 trunkObject[i].fromdomain,\
 trunkObject[i].fromuser\
 );
-        fprintf(conf_trunk_aors, "\
+                    fprintf(conf_trunk_aors, "\
+[%s]\n\
+type=aor\n\
+contact=%s\n\
+default_expiration=600\n\
+max_contacts=100\n\
+minimum_expiration=60\n\
+remove_existing=no\n\
+qualify_frequency=%s\n\
+authenticate_qualify=no\n\
+maximum_expiration=3600\n\
+outbound_proxy=%s\n\
+qualify_timeout=%s\n\
+\n",\
+trunkObject[i].trunk,\
+trunkObject[i].contact_uri,\
+trunkObject[i].qualifyfreq,\
+trunkObject[i].outbound_proxy,\
+trunkObject[i].qualify\
+);
+                    fprintf(conf_trunk_idfs, "\
+[%s]\n\
+type=identify\n\
+endpoint=%s\n\
+match=%s\n\
+",\
+trunkObject[i].trunk,\
+trunkObject[i].trunk,\
+trunkObject[i].match\
+);
+                }
+                else
+                {
+                    fprintf(conf_trunk_eps, "\
+[%s]\n\
+type = endpoint\n\
+transport = transport-%s\n\
+context = %s\n\
+disallow = all\n\
+allow = %s\n\
+aors = %s\n\
+direct_media = yes\n\
+connected_line_method = update\n\
+direct_media_method = update\n\
+direct_media_glare_mitigation = incoming\n\
+disable_direct_media_on_nat = yes\n\
+dtmf_mode = %s\n\
+force_rport = no\n\
+ice_support = no\n\
+identify_by = %s\n\
+outbound_auth =\n\
+outbound_proxy = %s\n\
+rewrite_contact = no\n\
+rtp_symmetric = no\n\
+send_diversion = no\n\
+send_pai = no\n\
+send_rpid = no\n\
+media_encryption = no\n\
+inband_progress = no\n\
+device_state_busy_at = 0\n\
+allow_transfer = yes\n\
+allow_subscribe = yes\n\
+sdp_session = IP Audio Center\n\
+tos_audio = ef\n\
+tos_video = AF41\n\
+from_domain = %s\n\
+from_user = %s\n\
+cos_audio = 5\n\
+cos_video = 4\n\
+user_eq_phone = no\n\
+rtp_keepalive = 60\n\
+rtp_timeout = 60\n\
+rtp_timeout_hold = 300\n\
+rtcp_mux = no\n\
+codec_prefs_incoming_answer = prefer:pending, operation:intersect, keep:all, transcode:allow\n\
+codec_prefs_incoming_offer = prefer:pending, operation:intersect, keep:all, transcode:allow\n\
+codec_prefs_outgoing_answer = prefer:pending, operation:intersect, keep:all, transcode:allow\n\
+codec_prefs_outgoing_offer = prefer:pending, operation:union, keep:all, transcode:allow\n\
+\n",\
+trunkObject[i].trunk,\
+trunkObject[i].transport,\
+trunkObject[i].context,\
+trunkObject[i].allow,\
+trunkObject[i].trunk,\
+trunkObject[i].dtmfmode,\
+trunkObject[i].identify_by,\
+trunkObject[i].outbound_proxy,\
+trunkObject[i].fromdomain,\
+trunkObject[i].fromuser\
+);
+                    fprintf(conf_trunk_aors, "\
 [%s]\n\
 type=aor\n\
 contact=%s\n\
@@ -610,7 +705,7 @@ trunkObject[i].qualifyfreq,\
 trunkObject[i].outbound_proxy,\
 trunkObject[i].qualify\
 );
-        fprintf(conf_trunk_idfs, "\
+                    fprintf(conf_trunk_idfs, "\
 [%s]\n\
 type=identify\n\
 endpoint=%s\n\
@@ -620,11 +715,12 @@ trunkObject[i].trunk,\
 trunkObject[i].trunk,\
 trunkObject[i].match\
 );
+                }
             }
             else
             {
                 fprintf(conf_trunk_auths, "\
-[%s_auth]\n\
+[auth_%s]\n\
 type = auth\n\
 auth_type = userpass\n\
 password = %s\n\
@@ -642,6 +738,7 @@ context = %s\n\
 disallow = all\n\
 allow = %s\n\
 aors = %s\n\
+auth = auth_%s\n\
 direct_media = yes\n\
 connected_line_method = update\n\
 direct_media_method = update\n\
@@ -651,7 +748,7 @@ dtmf_mode = %s\n\
 force_rport = no\n\
 ice_support = no\n\
 identify_by = %s\n\
-outbound_auth = %s_auth\n\
+outbound_auth = auth_%s\n\
 rewrite_contact = no\n\
 rtp_symmetric = no\n\
 send_diversion = no\n\
@@ -683,6 +780,7 @@ trunkObject[i].transport,\
 trunkObject[i].context,\
 trunkObject[i].allow,\
 trunkObject[i].voipusername,\
+trunkObject[i].voipusername,\
 trunkObject[i].dtmfmode,\
 trunkObject[i].identify_by,\
 trunkObject[i].voipusername,\
@@ -812,13 +910,12 @@ mytime()\
     if (did_size > 0){
         while(m < did_size){
             if (strcmp(didObject[m].didnumber, "") != 0 && strcmp(didObject[m].type, "") != 0){
-
-                //exten => _didnumber,1,Goto(default,_destexten,1)
                 if(strcmp(didObject[m].type, "extension") == 0){
                 fprintf(did_fp, "\
-exten => %s,1,Goto(default,%s,1)\
+exten => %s,1,Gosub(stdexten,s,1(%s,PJSIP/%s))\
 \n", \
 didObject[m].didnumber,\
+didObject[m].exten,\
 didObject[m].exten\
 );
                 }else if(strcmp(didObject[m].type, "ivr") == 0){

+ 4 - 4
generate_user_conf.c

@@ -294,7 +294,7 @@ musicclass = queuemusic\n\
                     continue;
                 }
                 
-                sprintf(strtmp,"include => paging-group-%s\n", g_row[0]);
+                sprintf(strtmp,"include => phones-group-%s\n", g_row[0]);
                 strcat(dialrule, strtmp);
 
                 if(paging)
@@ -361,7 +361,7 @@ musicclass = queuemusic\n\
                     fprintf(conf_user_queue_fp, "exten => %s,1,Gosub(queue,s,1(Q%d,${EXTEN},%s))\n", wb_row[0],q,u_row[3]);
                     fprintf(conf_user_queue_fp, "same => n,%s\n", noanswer_dest);
                     fprintf(conf_user_context_fp, "[DialRule_%s]\n",wb_row[0]);
-                    fprintf(conf_user_context_fp, "include => cdr-action\n");
+                    //fprintf(conf_user_context_fp, "include => cdr-action\n");
                     fprintf(conf_user_context_fp, "include => featurecodes\n");
                     fprintf(conf_user_context_fp, "%s\n", dialrule);
                 }
@@ -379,7 +379,7 @@ musicclass = queuemusic\n\
                             fprintf(conf_user_queue_fp, "exten => %s,1,Gosub(queue,s,1(Q%d,${EXTEN},%s))\n", pSub->valuestring,q,u_row[3]);
                             fprintf(conf_user_queue_fp, "same => n,%s\n", noanswer_dest);
                             fprintf(conf_user_context_fp, "[DialRule_%s]\n",pSub->valuestring);
-                            fprintf(conf_user_context_fp, "include => cdr-action\n");
+                            //fprintf(conf_user_context_fp, "include => cdr-action\n");
                             fprintf(conf_user_context_fp, "include => featurecodes\n");
                             fprintf(conf_user_context_fp, "%s\n", dialrule);
                         }
@@ -397,7 +397,7 @@ musicclass = queuemusic\n\
                             fprintf(conf_user_queue_fp, "exten => %s,1,Gosub(queue,s,1(Q%d,${EXTEN},%s))\n", pSub->valuestring,q,u_row[3]);
                             fprintf(conf_user_queue_fp, "same => n,%s\n", noanswer_dest);
                             fprintf(conf_user_context_fp, "[DialRule_%s]\n",pSub->valuestring);
-                            fprintf(conf_user_context_fp, "include => cdr-action\n");
+                            //fprintf(conf_user_context_fp, "include => cdr-action\n");
                             fprintf(conf_user_context_fp, "include => featurecodes\n");
                             fprintf(conf_user_context_fp, "%s\n", dialrule);
                         }