[Asterisk-Dev] Patch for OH323 to compile with last cvs

Lee LIsts lists at jave.dyndns.org
Tue Oct 5 05:25:45 MST 2004


diff -u -r1.1 chan_oh323.c
--- chan_oh323.c        2004/10/05 10:55:36     1.1
+++ chan_oh323.c        2004/10/05 11:45:39
@@ -1233,11 +1233,11 @@
        }

        /* Set CallerID on outgoing call */
-       if (c->callerid) {
+       if (c->cid.cid_num) {
                if (option_debug)
-                       ast_log(LOG_DEBUG, "%s: Generating CallerID 
'%s'\n", c->name, c->callerid);
+                       ast_log(LOG_DEBUG, "%s: Generating CallerID 
'%s'\n", c->name, c->cid.cid_num);
                memset(oldcid, 0, sizeof(oldcid));
-               strncpy(oldcid, c->callerid, sizeof(oldcid) - 1);
+               strncpy(oldcid, c->cid.cid_num, sizeof(oldcid) - 1);
                ast_callerid_parse(oldcid, &cidname, &cid);
                if (option_debug) {
                        ast_log(LOG_DEBUG, "CID is '%s'.\n", cid == NULL 
? "<NULL>":cid);
@@ -2376,53 +2376,25 @@
                                }
                        }
                }
-               if (strlen(tmp->exten) && strcmp(tmp->exten, "s"))
-                       tmp->dnid = strdup(tmp->exten);
+               if (strlen(tmp->exten) && strcmp(tmp->exten, "s")) {
+                       tmp->cid.cid_dnid = strdup(tmp->exten);
+               }

                /* Set caller ID */
                callerid_len = 10;
-               if ((i->cd.call_source_alias != NULL) &&
-                                               
(strlen(i->cd.call_source_alias) > 0))
-                       callerid_len += strlen(i->cd.call_source_alias);
-               if ((i->cd.call_source_e164 != NULL) &&
-                                               
(strlen(i->cd.call_source_e164) > 0))
-                       callerid_len += strlen(i->cd.call_source_e164);
-               tmp->callerid = (char *)malloc(callerid_len);
-               if (tmp->callerid != NULL) {
-                       memset(tmp->callerid, 0, callerid_len);
-                       if ((i->cd.call_source_alias != NULL) &&
-                                                       
(strlen(i->cd.call_source_alias) > 0)) {
-                               dnamelen = 
strcspn(i->cd.call_source_alias, "([");
-                               if (dnamelen < 
strlen(i->cd.call_source_alias)) {
-                                       strncat(tmp->callerid, "\"", 1);
-                                       strncat(tmp->callerid, 
i->cd.call_source_alias, dnamelen);
-                                       strncat(tmp->callerid, "\"", 1);
-                               } else {
-                                       strncat(tmp->callerid, "\"\"", 2);
-                                       dnamelen = 0;
-                               }
-                               if ((i->cd.call_source_e164 != NULL) &&
-                                                               
(strlen(i->cd.call_source_e164) > 0)) {
-                                       strncat(tmp->callerid, " <", 2);
-                                       strncat(tmp->callerid, 
i->cd.call_source_e164,
-                                                                       
strlen(i->cd.call_source_e164));
-                                       strncat(tmp->callerid, ">", 1);
-                               } else {
-                                       strncat(tmp->callerid, "<>", 2);
-                               }
-                       } else if ((i->cd.call_source_e164 != NULL) &&
-                                                               
(strlen(i->cd.call_source_e164) > 0))
-                               memcpy(tmp->callerid, 
i->cd.call_source_e164,
-                                                               
strlen(i->cd.call_source_e164));
-                       /* Set ANI */
-                       tmp->ani = strdup(tmp->callerid);
+               if ((i->cd.call_source_alias != NULL) && 
(strlen(i->cd.call_source_alias) > 0)) {
+                       tmp->cid.cid_name = strdup(i->cd.call_source_alias);
+               }
+               if ((i->cd.call_source_e164 != NULL) && 
(strlen(i->cd.call_source_e164) > 0)) {
+                       tmp->cid.cid_num = strdup(i->cd.call_source_e164);
+                       tmp->cid.cid_ani = strdup(tmp->cid.cid_num);
                }

                if (option_debug) {
                        ast_log(LOG_DEBUG, "Context is '%s', extension 
is '%s'.\n",
                                                        tmp->context, 
tmp->exten);
-                       if (tmp->callerid != NULL)
-                               ast_log(LOG_DEBUG, "CallerID/ANI is 
'%s'.\n", tmp->callerid);
+                       if (tmp->cid.cid_num != NULL)
+                               ast_log(LOG_DEBUG, "CallerID/ANI is 
'%s'.\n", tmp->cid.cid_num);
                }

                /* Set environment variables */



More information about the asterisk-dev mailing list