[Serusers] SER and Asterisk as voicemail

Jim Burwell jimb at jsbc.cc
Thu Nov 20 03:09:41 CET 2003


Yep.  If the existing set up I want to put this VM server into was set 
up such that all users, subscribers, and phones were set up with numeric 
user names instead of email-style textual ones, there would be no need 
for this at all. 

But the production environment I'm integrating Asterisk into already has 
everything set up with text style names.  This is easier than going 
around and changing everyone's phone config, SERweb logins, etc.

- Jim


Nils Ohlmeier wrote:

>Hello,
>
>maybe i'm too stupid to understand your problems completly, but wouldn't it be 
>easier to run your SER with aliases the other way round?
>I mean create and run only numerical users, but add alphabetical aliases. 
>(AFAIK nothing in SER insists on alphabetical usernames or numerical 
>aliases.) If a request with an alphabetical username in request URI comes in 
>convert it to numeric via aliases.
>But in any case you could just forward the request to your * box without 
>writing extensions.
>
>Greets
>  Nils
>
>On Thursday 20 November 2003 02:42, Jim Burwell wrote:
>  
>
>>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
>>    
>>

-- 
+---------------------------------------------------------------------------+
|         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. |
+---------------------------------------------------------------------------+






More information about the sr-users mailing list