[VoIP] Asterisk Version

John R. Covert john_reads_cnet_via_archives at covert.org
Wed Jul 18 14:14:00 CDT 2007


Soon (if not already) many of us will be going to Asterisk 1.4.
It now seems to be very solid on Linux, but not on Mac OS X yet.

Check what version I have up at the moment by calling CNET
1-263-9983 (main PBX) and 1-264-9983 (laptop).  Message is
non-sup.  The version message also plays after the supervised
message at -0001.

There is one completely incompatible forward or backward change
to ${ENUMLOOKUP(...)} that affects CNET.  Here's a version of
[cnetlookup] which will work regardless of which version is loaded,
and allow switching back and forth between the versions without having
to modify anything:

[cnetlookup]
exten => _X.,1,GotoIf($["${CUT(ASTERISK_VERSION,.,2)}" = "4"]?v1d4)
exten => _X.,n,Set(result=${ENUMLOOKUP(+${EXTEN},iax2,1,std.ckts.info)}) ; 1.2
exten => _X.,n,GotoIf($["${result}"!=""]?dialiax)
exten => _X.,n,Set(result=${ENUMLOOKUP(+${EXTEN},sip,1,std.ckts.info)}) ; 1.2
exten => _X.,n,GotoIf($["${result}"!=""]?dialsip:failed)

exten => _X.,n(v1d4),Set(result=${ENUMLOOKUP(+${EXTEN},iax2,,1,std.ckts.info)})
exten => _X.,n,GotoIf($["${result}"!=""]?dialiax)
exten => _X.,n,Set(result=${ENUMLOOKUP(+${EXTEN},sip,,1,std.ckts.info)}) ; 1.4
exten => _X.,n,GotoIf($["${result}"!=""]?dialsip)

exten => _X.,n(failed),Progress()
exten => _X.,n,Playback(enum-lookup-failed,noanswer)
exten => _X.,n,Macro(fastbusy)

exten => _X.,n(dialsip),Dial(SIP/${result},120)
exten => _X.,n,Macro(fastbusy)

exten => _X.,n(dialiax),Dial(IAX2/${result},120)
exten => _X.,n,Macro(fastbusy)

Now, there are two things the above code needs in order to work.
Unfortunately, the variable ASTERISK_VERSION isn't supplied.  So
you need to do the following:

1. Create a file in /etc/asterisk called setversion.sh which
   contains two lines:
	#/bin/sh
	echo ASTERISK_VERSION=$(/usr/sbin/asterisk -V)
2. Make it executable: chmod +x /etc/asterisk/setversion.sh
3. Add the following to /etc/asterisk/asterisk.conf
	[options]
	execincludes => yes
4. Add the following line to extensions.conf up in the [globals]
   section
	#exec </etc/asterisk/setversion.sh>

The other thing you need is [macro-fastbusy], but I'll discuss that in
a completely separate thread (subject: Congestion and Busy Handling).
You could, of course, do what you normally do when the Dial command
fails.

/john


More information about the VoIP mailing list