[ N O C T E R N I T Y ] Contributing to the general pollution of the internet

21Mar/130

Playing with Asterisk (2/?)

Last time I managed to get a very basic Asterisk setup to work. Since then, I haven't had the time to really work on it, but I've made a few improvements here and there.

Dial plan improvements

In quite a few documents I read, dial plans always include a Hangup() line for all extensions, whatever they contain. I'm not 100% sure it's actually useful, but I added it anyway:

exten => 100,1,Dial(SIP/test1)
        exten => 100,2,Hangup()

exten => 101,1,Dial(SIP/test2)
        exten => 101,2,Hangup()

One of the things that was a little scary about the dial plan in general was the fact that I would have needed to renumber all lines for an extension if I wanted to insert stuff in one of its parts. That would have been rather annoying. As it turns out, Asterisk supports using "n" as the priority field in the dial plan's extension definitions. Using it causes Asterisk to handle the "line numbering" automatically (with the exception of the first line that still needs to be 1):

exten => 8378,1,Answer()
        exten => 8378,n,Playback(hello-world)
        exten => 8378,n,Hangup

exten => 100,1,Dial(SIP/test1)
        exten => 100,n,Hangup()

exten => 101,1,Dial(SIP/test2)
        exten => 101,n,Hangup()

Finally, I started using global variables to define the dialing targets, which would make it much easier to change if I needed to:

[globals]
        DIAL_TEST1=SIP/test1
        DIAL_TEST2=SIP/test2

[test]

; ...

exten => 100,1,Dial(${DIAL_TEST1})
        exten => 100,n,Hangup()

; ...

Granted, it is "a little" pointless in this context, but it will come in handy later.

Caller IDs for SIP clients

I also added caller IDs for SIP clients. It is extremely simple to do that by simply adding a line that looks like this...

        callerid="TSeeker's mobile" <101>

...to a SIP client's configuration.

Transferring calls

One other thing I added is the ability to transfer calls. First, I started by creating a features.conf file in order to define the DTMF sequences to use. Here's what it contains:

[general]
        ; Empty

[featuremap]
        blindxfer => #1
        atxfer => #2

[applicationmap]
        ; Empty

This is not strictly necessary, as the defaults can be used. Anyway - the next step is to enable the functionality when calls are being made. This is done from the dial plan:

; ...
exten => 100,1,Dial(${DIAL_TEST1},,tT)
; ...

In this specific case, I want to allow both sides to transfer the calls, as these are internal phones anyway (I added a third client on Ju's also-microphone-less PC to run tests).

Miscellaneous changes

Amongst other minor changes, I also re-configured logging using the following configuration in logger.conf:

[general]
        ; Empty

[logfiles]
        console => notice,warning,error,debug
        messages => notice,warning,error

No need for Asterisk-based log file rotation as the Debian package handles that using logrotate.

I also modified modules.conf to remove more currently useless modules (it's just a bunch of noload's for stuff I know I'm not gonna need so I'm not pasting this here).

Finally, I did not add IPv6 support yet, as I need to upgrade to 1.8 for that and I figured IPv4 would be fine for testing purposes; I don't expect many things to change because of IPv6 support anyway (although I may be wrong).

Posted by Emmanuel Benoît

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

 

No trackbacks yet.