On Fri, Aug 11, 2017 at 01:29:18PM +0300, vs@cell.tel wrote:
How its possible to route all 7XXX destined calls from Kamailio users to Asterisk, while Asterisk is behind NAT??? Config examples, i found, were writen only for situation with fixed asterisk IP and PORT, without nat ( asterisk.bindip = "" ; asterisk.bindport = "")
There is nothing special about this scenario, asterisk is an enduser for kamailio. Have it register to kamailio and use for example the alias_db module to send 7XXX numbers to the registered asterisk user. All this is in the supplied example config kamailio-advanced.cfg.
On Sat, Aug 12, 2017 at 08:49:45AM +0300, vs@cell.tel wrote:
Using alias_db - 7XXX calls were succesfully aliased and routed to Asterisk through 4444 user (asterisk server did not accept connections to sip ports from Internet due to security reasons). On asterisk side, all this calls had equal extension, configured in sip.conf "REGISTER =>.../exten" string. So I had to extract right exten from TO: header in dialplan like this:
... asterisk conf ...
Alternative is to first do the lookup in kamailio and then restore the $rU variable:
$var(orgRu)=$rU; if lookup()/alias_db_lookup success $rU=$var(orgRu);
One disadvantage with alias_db - is that i cant use regex to alias all 7XXX numbers with 4444 user, so i need to create aliases for every 7XXX user in dbaliases table using this scenario. Is the any other not very difficult way to route all 7XXX calls in Kamailio to Asterisk through 4444 user without creating alias dbrecords for every number?
A way to do this is by storing prefixex in the aliasdb table. I use this brilliant piece of code to match exact numers, 10 number blocks, 100 and 1000 number blocks.
if(!alias_db_lookup("dbaliases")) { strip_tail(1);
if(!alias_db_lookup("dbaliases")) { strip_tail(1); if(!alias_db_lookup("dbaliases")) { strip_tail(1); alias_db_lookup("dbaliases"); } } }
Since my dbaliases contains full e164 number/prefixes there are no collisions. Adapt for your number schemes.
An alternative is to use sqlops to do custom queries and for example retrieve the username and use lookup() to route.
Yes, it requires a very particular configuration. With asterisk you in sip.conf you need
externaddr=you.public.ip
This is used in SIP registrations by Asterisk. You should also be comfortable with debugging the SIP traffic to make sure all IP's are set properly. For asterisk:
sip set debug on
Look for REGISTER messages.
Another amazing tool for this is sipgrep ( https://github.com/sipcapture/sipgrep). It's like ngrep but for SIP.
Benjamin Fitzgerald LETS Corporation (925) 566-5600 ext. 25 ben@letscorp.us
*******Confidential Notice: This message is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this message in error, please delete this message from all computers and contact Orion Systems/LETS Corp immediately by return e-mail and/or telephone at (925) 566-5600
On Fri, Aug 11, 2017 at 3:29 AM, vs@cell.tel wrote:
Hi!
Could anyone advice me or provide an example of Kamailio config to solve this case:
Current Kamailio+Asterisk schema: (7XXX Users) <-> Asterisk <-> NAT <-> Internet <-> Kamailio <-> (4XXX Users)
7XXX Users registers on Asterisk server, and 4XXX Users registers on Kamailio. In Addition, Asterisk registers on Kamailio with user 4444, and it is possible to make calls from 7XXX Users (Asterisk) to 4XXX Users (Kamailio) through 4444 "trunk". Also, while Kamailio users (4XXX) call to 4444 number, call successfully goes to Asterisk.
How its possible to route all 7XXX destined calls from Kamailio users to Asterisk, while Asterisk is behind NAT???
Config examples, i found, were writen only for situation with fixed asterisk IP and PORT, without nat ( asterisk.bindip = "" ; asterisk.bindport = "")
Thanks in advance
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Fri, Aug 11, 2017 at 09:35:45AM -0700, Benjamin Fitzgerald wrote:
Another amazing tool for this is sipgrep ( https://github.com/sipcapture/sipgrep). It's like ngrep but for SIP.
And here I thought sngrep was the ngrep for SIP :)