[Serusers] SER and Asterisk as voicemail

Jim Burwell jimb at jsbc.cc
Thu Nov 20 02:42:05 CET 2003


I'm presently working up an Asterisk voice mail set up which runs in a 
SER environment myself.

One problem I ran into was that in the "typical" SER set up is that SER 
calls Asterisk with a textual SIP URI in the form of 
"sip:text_user_name at domain", where Asterisk is really designed for 
traditional numerical phone numbers. 

By "typical" SER set up, I mean one in which users are defined as 
"sip:testname at domain" and numerical phone numbers are simply SER aliases 
which point to the textual SIP URIs.  This is kind of nice since a user 
is identified as a name instead of a number, and it can match the users 
email address, etc.

The problem with this sort of set up is that when you configure SER to 
call Asterisk for voice mail, even if a numerical extension was dialed 
for that user, SER translates it to the "name" form and uses it in the 
INVITE message to Asterisk (even though it leaves the To: header as the 
originally dialed numeric #).  Asterisk's SIP module takes this INVITE 
as the dialed extension, so you wind up with Asterisk searching for a 
user name instead of a numeric extension.  You CAN actually set up 
textual extensions to match these types of calls, but that's kinda 
"wrong" in Asterisk, and there's a possibility that the text user names 
could collide with some of Asterisk's reserved text extensions.  Also, 
to do this you must then have an entry for every single user in 
extensions.conf, and map them individually to numeric extensions.  Not 
very good.

To solve this problem, I wound up using Asterisk's AGI interface to 
write a Perl script which when all numeric matches fail, is called and 
maps the SIP user name back into a numeric extension by calling the SER 
aliases database. 

For example, user dials "5502" on his phone, SER translates this into 
"sip:joeuser at somedomain.com", and procedes with the routing.  Then, when 
the user doesn't answer the phone (or there's no location info for him), 
it gets routed to the Asterisk VM server.  Asterisk then sees the dialed 
extension as "joeuser" instead of the original "5502", and falls through 
all the numerical extension matches to my AGI call in the extensions 
file.  This then looks up "sip:joeuser at somedomain.com" in the aliases 
table, and returns "5502" in a Asterisk variable using AGI.  Then the 
call can be properly routed to a voice mail box.  Here's what the actual 
extensions.conf rules look like:

    exten => _.,1,AGI(map-ser-aliases-contact-to-ast-extension.agi)
    exten => _.,2,GotoIf($[${rewriteext} = NOTFOUND]?3:4)
    exten => _.,3,Goto(vm-prompt,s,1)
    exten => _.,4,Voicemail(u${rewriteext})
    exten => _.,5,Wait(1)
    exten => _.,6,Hangup


If the extension is found, the variable is set to the numeric extension 
(if there are more than one, it picks the lowest numerical extension 
returned by the database).  If no matching entry is found, or the entry 
is textual, the variable is set to "NOTFOUND" and the extensions.conf 
matching code can do the appropriate thing.

This is working pretty good in my test environment, but I havn't put it 
into actual production yet.

I really wish Asterisk had a similar set up for the voicemail.conf 
file.  For now, I plan to write another Perl script which can generate 
entries for this file by reading info from the SER database.

Let me know if any of you guys have interest in this...

- Jim


Jesus Rodriguez wrote:

>On Fri, 14 Nov 2003, Alessio Focardi wrote:
>
>Hi Alessio,
>
>  
>
>>I imagined the redirection part just like you say, but from what I have understood about asterisk I will have to set up
>>an extension and a mailbox for every ser user. This looks "time consuming" :)
>>    
>>
>
>Not really. You don't need an entry in extensions.conf for every mailbox/user.
>You can use something like this:
>
>[default]
>;mapping from 34... to 93390...
>exten => _34XXXXXXXX,1,Goto(9339059${EXTEN:8},1)
>
>;voicemail extensions
>exten => _9339059XX,1,Wait(2)
>exten => _9339059XX,2,Voicemail2(u${EXTEN})
>
>
>And then in voicemail.conf :
>
>933905903 => 1003,User one, user1 at voztele.com
>933905904 => 1004,User two, user2 at voztele.com
>933905905 => 1005,User three, user3 at voztele.com
>933905906 => 1006,User four, user4 at voztele.com
>
>
>  
>
>>Also: What about playback of recorded messages ?
>>    
>>
>
>Works ok, You can configure the codec/s you allow and the audio format of the
>recorded message.
>
>
>  
>
>>If anyone has asterisk config files to share ... just to get an idea!
>>    
>>
>
>Hope this helps.
>
>
>
>
>  
>
>>BAI> Hi,
>>
>>BAI> I have some experience with setting ser to use Asterisk as voicemail
>>BAI> system and it worked without any problem. What you have to do is to
>>BAI> configure ser to redirect all call for unregistered or busy users to the
>>BAI> address (IP:port) of your asterisk voicemail box. No special issues... :-)
>>
>>BAI> Bogdan
>>
>>BAI> Alessio Focardi wrote:
>>
>>    
>>
>>>>HI,
>>>>
>>>>is there anyone using Asterisk as voicemail backend for SER ?
>>>>
>>>>I would like to know if this is possible and what can I expect from
>>>>this integration ...
>>>>
>>>>Tnx !
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>
>>--
>>Best regards,
>> Alessio                            mailto:alessiof at interconnessioni.it
>>
>>_______________________________________________
>>Serusers mailing list
>>serusers at lists.iptel.org
>>http://lists.iptel.org/mailman/listinfo/serusers
>>
>>    
>>
>
>
>Saludos
>JesusR.
>
>-------------------------------
>Jesus Rodriguez
>VozTelecom Sistemas, S.L.
>jesusr at voztele.com
>http://www.voztele.com
>Tel. 902360305
>-------------------------------
>
>_______________________________________________
>Serusers mailing list
>serusers at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serusers
>  
>

-- 
+---------------------------------------------------------------------------+
|         Jim Burwell - Sr. Systems/Network/Security Engineer, JSBC         |
+---------------------------------------------------------------------------+
| "I never let my schooling get in the way of my education." - Mark Twain   |
| "UNIX was never designed to keep people from doing stupid things, because |
|  that policy would also keep them from doing clever things." - Doug Gwyn  |
| "Cool is only three letters away from Fool" - Mike Muir, Suicyco          |
| "..Government in its best state is but a necessary evil; in its worst     |
|  state an intolerable one.." - Thomas Paine, "Common Sense" (1776)        |
+---------------------------------------------------------------------------+
|   Email:  jimb at jsbc.cc                              ICQ UIN:  1695089     |
+---------------------------------------------------------------------------+
|  Reply problems ?  Turn off the "sign" function in email prog.  Blame MS. |
+---------------------------------------------------------------------------+

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20031119/9cf9c14d/attachment.htm>


More information about the sr-users mailing list