]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 289094 via svnmerge from
authorBrett Bryant <bbryant@digium.com>
Tue, 28 Sep 2010 18:14:19 +0000 (18:14 +0000)
committerBrett Bryant <bbryant@digium.com>
Tue, 28 Sep 2010 18:14:19 +0000 (18:14 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r289094 | bbryant | 2010-09-28 14:10:19 -0400 (Tue, 28 Sep 2010) | 14 lines

  Fixes an issue with the Newchannel AMI event during the Masquerading process.

  Fixes an issue with the Newchannel AMI event during the Masquerading process,
  where no Newchannel AMI event was generated for the psuedo channel used during
  the masquerading process.

  (closes issue #17987)
  Reported by: RadicAlish
  Patches:
        newchannel.patch.txt uploaded by RadicAlish (license 1122)
        Tested by: RadicAlish

        Review: https://reviewboard.asterisk.org/r/937/
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@289095 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index e59b43fe3947a86a7053b1a7e99919f3416e6c71..de3f6d8d70388565dff4b5c8a87f4fe01192457a 100644 (file)
@@ -778,7 +778,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
        int x;
        int flags;
        struct varshead *headp;
-       char *tech = "";
+       char *tech = "", *tech2 = NULL;
 
        /* If shutting down, don't allocate any new channels */
        if (shutting_down) {
@@ -883,7 +883,7 @@ alertpipe_failed:
        tmp->cid.cid_num = ast_strdup(cid_num);
        
        if (!ast_strlen_zero(name_fmt)) {
-               char *slash;
+               char *slash, *slash2;
                /* Almost every channel is calling this function, and setting the name via the ast_string_field_build() call.
                 * And they all use slightly different formats for their name string.
                 * This means, to set the name here, we have to accept variable args, and call the string_field_build from here.
@@ -894,6 +894,10 @@ alertpipe_failed:
                ast_string_field_build_va(tmp, name, name_fmt, ap1, ap2);
                tech = ast_strdupa(tmp->name);
                if ((slash = strchr(tech, '/'))) {
+                       if ((slash2 = strchr(slash + 1, '/'))) {
+                               tech2 = slash + 1;
+                               *slash2 = '\0';
+                       }
                        *slash = '\0';
                }
        }
@@ -950,7 +954,7 @@ alertpipe_failed:
         * proper and correct place to make this call, but you sure do have to pass
         * a lot of data into this func to do it here!
         */
-       if (ast_get_channel_tech(tech)) {
+       if (ast_get_channel_tech(tech) || (tech2 && ast_get_channel_tech(tech2))) {
                manager_event(EVENT_FLAG_CALL, "Newchannel",
                        "Channel: %s\r\n"
                        "ChannelState: %d\r\n"