Yu.ding 2 years ago
parent
commit
a1ae40c75b
2 changed files with 12 additions and 9 deletions
  1. 9 8
      usr/src/generate_trunk_conf.c
  2. 3 1
      usr/src/generate_user_conf.c

+ 9 - 8
usr/src/generate_trunk_conf.c

@@ -884,14 +884,15 @@ trunkObject[i].allow\
                         strcat(registrationString,trunkObject[i].contact);
                         //sprintf(registrationString, "%s/%s", registrationString, trunkObject[i].contact);
                     }
-
-                    if (strcmp(trunkObject[i].transport, "tcp") == 0){
-                        fprintf(registration_fp, "register=tcp://%s\n", registrationString);
-                    }else if (strcmp(trunkObject[i].transport, "tls") == 0){
-                        fprintf(registration_fp, "register=tls://%s\n", registrationString);
-                    }else{
-                        fprintf(registration_fp, "register=%s\n", registrationString);
-                        // printf("%d\nregistrationString:%s\n", __LINE__, registrationString);
+                    if(strcmp(trunkObject[i].trunkstyle, "SIP") == 0){
+                        if (strcmp(trunkObject[i].transport, "tcp") == 0){
+                            fprintf(registration_fp, "register=tcp://%s\n", registrationString);
+                        }else if (strcmp(trunkObject[i].transport, "tls") == 0){
+                            fprintf(registration_fp, "register=tls://%s\n", registrationString);
+                        }else{
+                            fprintf(registration_fp, "register=%s\n", registrationString);
+                            // printf("%d\nregistrationString:%s\n", __LINE__, registrationString);
+                        }
                     }
                 }
             }

+ 3 - 1
usr/src/generate_user_conf.c

@@ -317,6 +317,7 @@ musicclass = queuemusic\n\
 \n",q,g_row[2]);
             dJson = cJSON_Parse(g_row[4]);
             memset(noanswer_dest,0,sizeof(noanswer_dest));
+            printf("parse json: id-%d, type-%s, exten-%s\n",cJSON_GetObjectItem(dJson, "id")->valueint, cJSON_GetObjectItem(dJson, "type")->valuestring, cJSON_GetObjectItem(dJson, "exten")->valuestring);
             if(dJson)
             {
                 if(strcmp(cJSON_GetObjectItem(dJson, "type")->valuestring, "hangup") == 0){
@@ -327,7 +328,7 @@ musicclass = queuemusic\n\
                 }
                 else if(strcmp(cJSON_GetObjectItem(dJson, "type")->valuestring, "user") == 0){
                     int id = 100000 + cJSON_GetObjectItem(dJson, "id")->valueint;
-                    sprintf(noanswer_dest,"Goto(manager-queue-%s,s,1)",id);
+                    sprintf(noanswer_dest,"Goto(manager-queue-%d,s,1)",id);
                 }
                 else if(strcmp(cJSON_GetObjectItem(dJson, "type")->valuestring, "outcall") == 0){
                     sprintf(noanswer_dest,"Goto(CallingRule_OutCall,%s,1)",cJSON_GetObjectItem(dJson, "exten")->valuestring);
@@ -337,6 +338,7 @@ musicclass = queuemusic\n\
             {
                 strcpy(noanswer_dest,"Goto(hangup,s,1)");
             }
+            printf("parse success\n");
             if(iCount > 0)
             {
                 if(strcmp(g_row[2],"ringall") == 0){