[asterisk-users] realtime config and extensions.conf

Jeff LaCoursiere jeff at jeff.net
Fri Aug 7 14:08:21 CDT 2009


Howdy,

My first forray into using res_mysql.conf for realtime access of sip users 
and extensions.

I have the following relevant section of extensions.conf:

---

[trunklocal]
exten => _NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[local]
include => trunklocal
include => trunktollfree

[longdistance]
include => local
include => trunkld

[international]
include => longdistance
include => trunkint

[from-pstn]
exten => 7157999,1,VoicemailMain()
switch => Realtime

[residential]
include => from-pstn
include => international

---

And the relevant entries in the DB:

mysql> select name, context from sip_buddies;
+---------+-------------+
| name    | context     |
+---------+-------------+
| 7157986 | residential |
| 7157980 | residential |
+---------+-------------+
2 rows in set (0.01 sec)

mysql> select * from extensions;
+----+-------------+---------+----------+------------+-------------+
| id | context     | exten   | priority | app        | appdata     |
+----+-------------+---------+----------+------------+-------------+
| 10 | residential | 7157986 |        1 | Dial       | SIP/7157986 |
| 11 | residential | 7157986 |        2 | Congestion |             |
| 12 | residential | 7157980 |        1 | Dial       | SIP/7157980 |
| 13 | residential | 7157980 |        2 | Congestion |             |
+----+-------------+---------+----------+------------+-------------+
4 rows in set (0.00 sec)

---

The phone I am testing with has a sip entry in "sip_buddies" with a 
context of "residential".  As you can see from the cascading contexts 
above the "residential" context can dial local 7 digit numbers via the 
TRUNK (a zap T1 with an inbound context of "from-pstn"), but dialing the 
Voicemail main number, also seven digits, overrides this and is executed 
directly.  This all works as expected and seems fairly elegant.

I also expected that the "switch => Realtime" statement in "[from-pstn]" 
would allow any local numbers in the "extensions" table to also override 
the trunk dialing, but it does not.  So my test phone, when it dials a 
local number that exists in the "extensions" table, ends up sending the 
call out the TRUNK, then it comes back in the TRUNK on another channel, 
and then dials the SIP phone as expected.  The call at least goes through 
:)  But it does kill the video H.264 stream I was hoping for!

How can I make sure that the realtime entries override the pattern 
matching in [trunk-local]?

Thanks,

j



More information about the asterisk-users mailing list