[Asterisk-Users] asterisk and Broadvoice Outgoing Again :(

Brian Dingman bdingman at gmail.com
Sun Mar 13 23:34:04 MST 2005


I thought this patch was added into the 1.04 and later source code?


On Mon, 14 Mar 2005 07:24:44 +0200, Dimitris Kounalakis
<dcoun at medsite.info> wrote:
> I never managed to make outgoing calls to broadvoice without the
> following patch to the file channels/chan_sip.c
> it comes from http://edvina.net/broadvoice/ and it is the only fraction
> that it is still needed for outgoing calls.
> It does not cause any problems with other sip devices that are connected
> to my asterisk box.
> if you do not patch it, then in sip debug you will notice that
> broadvoice gives you an error message:
> I do not remember it anymore, but it should be unauthorised or access
> not allowed something like this.
> ----------------------------------------------------
> --- channels/chan_sip.c.old     2005-03-12 18:10:49.000000000 +0200
> +++ channels/chan_sip.c 2005-03-14 07:20:18.000000000 +0200
> @@ -3701,16 +3701,28 @@
>                 /* If we have full contact, trust it */
>                 strncpy(invite, p->fullcontact, sizeof(invite) - 1);
>         /* Otherwise, use the username while waiting for registration */
> -       } else if (!ast_strlen_zero(p->username)) {
> -               if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
> -                       snprintf(invite, sizeof(invite),
> "sip:%s@%s:%d",p->username, p->tohost, ntohs(p->sa.sin_port));
> +} else {
> +               /* If we have set the fromdomain, this is also used
> +                  as the to domain for SIP calls to a peer. Fromdomain
> +                  is used for calls to SIP proxys mostly
> +               */
> +               char fromdomain[256];
> +               if (!ast_strlen_zero(p->fromdomain)) {
> +                       strncpy(fromdomain, p->fromdomain,
> sizeof(fromdomain) -1);
>                 } else {
> -                       snprintf(invite, sizeof(invite),
> "sip:%s@%s",p->username, p->tohost);
> +                       strncpy(fromdomain, p->tohost,
> sizeof(fromdomain) -1);
> +               }
> +               if (!ast_strlen_zero(p->username)) {
> +                       if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
> +                               snprintf(invite, sizeof(invite),
> "sip:%s@%s:%d",p->username, fromdomain, ntohs(p->sa.sin_port));
> +                       } else {
> +                               snprintf(invite, sizeof(invite),
> "sip:%s@%s",p->username, fromdomain);
> +                       }
> +               } else  if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
> +                       snprintf(invite, sizeof(invite), "sip:%s:%d",
> fromdomain, ntohs(p->sa.sin_port));
> +               } else {
> +                       snprintf(invite, sizeof(invite), "sip:%s",
> fromdomain);
>                 }
> -       } else if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
> -               snprintf(invite, sizeof(invite), "sip:%s:%d", p->tohost,
> ntohs(p->sa.sin_port));
> -       } else {
> -               snprintf(invite, sizeof(invite), "sip:%s", p->tohost);
>         }
>         strncpy(p->uri, invite, sizeof(p->uri) - 1);
>         /* If there is a VXML URL append it to the SIP URL */
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list