[OpenSIPS-Users] Dial Plan Module

Sean Salomon ssalomon at icoe.org
Tue May 25 23:20:59 CEST 2010


Brett,

	Would I replace this 

dp_translate("2", "$ruri.user/$avp(s:dest)");
xlog("translated to var $avp(s:dest) \n");


with the following, And that would push the translation on?

dp_translate("2", "$ruri.user/$ruri.user")


Sean Salomon

From: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] On Behalf Of Brett Nemeroff
Sent: Tuesday, May 25, 2010 2:14 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Dial Plan Module

The problem is that:
dp_translate("2", "$ruri.user/$avp(s:dest)");
That line sticks the translated value into that avp and not into the ruri. So the lookup still looks at the originally dialed number

-Brett



On Tue, May 25, 2010 at 4:05 PM, Sean Salomon <ssalomon at icoe.org> wrote:
Hello,

       I am implementing the Dial Plan Module and I might be missing
something. I added the module info for the opensips.cfg files as shown
below. Created the translations. When running opensips in debug=8 I get
the blow output. It appears to be matching to a rule, then properly
translating. But then It doesn't appear to be passing the output and the
call fails with a 404. Am I missing something?

Thanks in advance..


############## Dialplan entry into the opensips.cfg file ##############

loadmodule "dialplan.so"
#----- dialplan params -----
modparam("dialplan", "db_url",
"mysql://username:password@localhost/opensips")
modparam("dialplan", "attrs_pvar", "$avp(s:dest)")


       # account only INVITEs
       if (is_method("INVITE")) {
dp_translate("2", "$ruri.user/$avp(s:dest)");
xlog("translated to var $avp(s:dest) \n");
setflag(1); # do accounting

############## Translation ##############

mysql> select * from dialplan;
+----+------+----+----------+-----------+-----------+-------------+-----
-----+-------+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp   |
repl_exp | attrs |
+----+------+----+----------+-----------+-----------+-------------+-----
-----+-------+
|  7 |    2 |  0 |        1 | ^5900+    |         0 | ^(5900)(.+) | \2
|       |
+----+------+----+----------+-----------+-----------+-------------+-----
-----+-------+
1 row in set (0.00 sec)


############## Debug=8 output ##############

May 25 12:36:13 [5414] DBG:dialplan:dp_translate_f: input is 59008432
May 25 12:36:13 [5414] DBG:dialplan:translate: regex operator testing
May 25 12:36:13 [5414] DBG:dialplan:test_match: test string 59008432
against a pattern ^5900+
May 25 12:36:13 [5414] DBG:dialplan:test_match: test_match:[0] 5900
May 25 12:36:13 [5414] DBG:dialplan:translate: found a matching rule
0xb39e2498: pr 0, match_exp ^5900+
May 25 12:36:13 [5414] DBG:dialplan:test_match: test string 59008432
against a pattern ^(5900)(.+)
May 25 12:36:13 [5414] DBG:dialplan:test_match: test_match:[0] 59008432
May 25 12:36:13 [5414] DBG:dialplan:test_match: test_match:[1] 5900
May 25 12:36:13 [5414] DBG:dialplan:test_match: test_match:[2] 8432
May 25 12:36:13 [5414] DBG:dialplan:dp_translate_f: input 59008432 with
dpid 2 => output 8432
translated to var
May 25 12:36:13 [5414] DBG:core:grep_sock_info: checking if host==us:
14==9 &&  [sip.k12hsn.org] == [127.0.0.1]
May 25 12:36:13 [5414] DBG:core:grep_sock_info: checking if port 5060
matches port 5060
May 25 12:36:13 [5414] DBG:core:grep_sock_info: checking if host==us:
14==14 &&  [sip.k12hsn.org] == [207.62.103.166]
May 25 12:36:13 [5414] DBG:core:grep_sock_info: checking if port 5060
matches port 5060
May 25 12:36:13 [5414] DBG:core:grep_sock_info: checking if host==us:
14==9 &&  [sip.k12hsn.org] == [127.0.0.1]
May 25 12:36:13 [5414] DBG:core:grep_sock_info: checking if port 5060
matches port 5060
May 25 12:36:13 [5414] DBG:core:grep_sock_info: checking if host==us:
14==14 &&  [sip.k12hsn.org] == [207.62.103.166]
May 25 12:36:13 [5414] DBG:core:grep_sock_info: checking if port 5060
matches port 5060
May 25 12:36:13 [5414] DBG:registrar:lookup: '59008432' Not found in
usrloc

Sean Salomon


_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list