MWI and chan_sip.so

drech

New Member
Joined
Dec 3, 2007
Messages
5
Reaction score
0
[SOLVED] MWI and chan_sip.so

Hi all,

I'm having some trouble with MWI.

I have a MetaSwitch softswitch that had a trixbox configured into it for voicemail services (as a standard application server). Everything worked except for the MWI. To get MWI working, I had to change chan_sip.c as follows and recompile (from voip-info.org):

Code:
--- channels/chan_sip.c.orig    Thu Jul 14 12:03:18 2005
+++ channels/chan_sip.c Thu Jul 14 12:05:26 2005
@@ -9710,6 +9710,7 @@
        /* Called with peerl lock, but releases it */
        struct sip_pvt *p;
        int newmsgs, oldmsgs;
+       char *s;

        /* Check for messages */
        ast_app_messagecount(peer->mailbox, &newmsgs, &oldmsgs);
@@ -9735,6 +9736,10 @@
        /* Recalculate our side, and recalculate Call ID */
        if (ast_sip_ouraddrfor(&p->sa.sin_addr,&p->ourip))
                memcpy(&p->ourip, &__ourip, sizeof(p->ourip));
+       strcpy(p -> username, peer -> mailbox);  /* Username = Mailbox name */
+       s = strchr(p -> username, '@');          /* Remove the context part */
+       if (s != NULL)
+                *s = 0;
        build_via(p, p->via, sizeof(p->via));
        build_callid(p->callid, sizeof(p->callid), p->ourip, p->fromdomain);
        /* Send MWI */
After moving the VM to our main VM host, the prompts starting having issues with choppiness that nothing seemed to fix. I then read that the trixbox VMs have a problem with choppy audio and that a dedicated machine is needed. As this doesn't fit in with the direction our infrastructure is moving, I decided to test PiaF. The audio problems disappeared when running from VM and everything is great, except MWI.

The code between the version above and the current asterisk version is different and my attempts to attain the same MWI functionality have failed.

Does anyone know how to modify the current chan_sip.c to get the same effect as the changes above did for the older version?

Any help is much appreciated,
Dustin
 
Hi

I find it difficult to believe that at this stage of Asterisk development, MWI does not just work.

Do you use more than one make of phone - are the problems the same across all phone types.

Maybe the FreePBX forum can cast some light on this.

My first action would be to contact tech support of the phone.

Joe

PS - a very courageous descision to run a production server on a Virtual Machine
 
If the phones were directly attached to the asterisk box I'd agree that MWI just works.

In this config, however, the phones are managed by the MetaSwitch and Asterisk is responsible only for voicemail services.

In the current chan_sip.c, only subscribed peers are able to receive SIP MWI notifications but the MetaSwitch prefers unsolicited notifications, so when the SIP notify is sent to the MetaSwitch, it's sent with incomplete 'From' header info. (it currently shows Unknown in the From SIP header instead of the extension number like it should).

The modificatin to chan_sip.c I posted above resolves the issue, but it's for an earlier version. Any similar modifications I make to the new file result in either seg faults or no MWI being sent to the MetaSwitch.

Dustin
 
Aaah understood.

Maybe PiaF is not the most elegant solution for you.

If you are feeling in an experimental frame of mind, why not try installing asterisk 1.2.25 on the PiaF box.

Go though each directory in /usr/src /asterisk /Libpri /asterisk-addons /zaptel and type make clean

Then download 1.2 sources for asterisk, then make clean, make, and make install in each directory.

Then apply your patch.

There is no reason why PiaF cannot work with 1.2, it's just a question of whether the existing install will muck up an install of 1.2.

I'll take no responsibility of the above causing you to do a complete re-install ;-)

Joe
 
Hi

I'm eager to find out what happens next ;-)

Joe
 
love to see the outcome

If you are daring enough and try it and it works please post your steps. I am not daring enough to be the first.
 
Resolution

Here are the changes needed to get unsolicited SIP message-summary Notifications sent to an unregistered peer (asterisk version 1.4.13):

Code:
chan_sip.c:15203:       char *mwiuser;
chan_sip.c:15238:               mwiuser = strtok(peer->mailbox, "@");
chan_sip.c:15239:               strcpy(peer->username, mwiuser);
Notes:

1. The extension in Asterisk must match the 10-digit DID on the peer, the extension's 'host' entry must be the IP of the peer

2. The context of the extension must be set to a custom context, defined below

3. The custom context (below) defined in extensions_custom.conf. It changes the caller id of the calling party to the number they called, for routing to the proper voicemail box:

Code:
[custom-get-did-sip]
exten => _.,1,Noop(Fixing DID using RDNIS)
exten => _.,n,Set(pseudodid=${CALLERID(rdnis)})
exten => _.,n,Goto(from-trunk,${pseudodid},1)
Once the extension is setup and the chan_sip.c patched and recompiled (and copied to /usr/lib/asterisk/modules), MWI notifications are sent (toggled on and off) to the MetaSwitch managed phones.

Probably not useful to very many, but you never know ;)

Thanks!
Dustin
 

Members online

Forum statistics

Threads
26,687
Messages
174,411
Members
20,257
Latest member
Dempan
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top