You know, first time I used the "fantastic" dialplan module it didn't work.. When I went back and did a select * from dialplan, I noticed that what was IN the table wasn't anything like what I put into the table.<div>
<br></div><div>Seems that because of all the crazy PCRE symbols, there was quite a bit of escaping that needed to be done for it to get into the table properly. So, try that.. check the actual contents in the table and see if it's what is expected..</div>
<div><br></div><div><br><div class="gmail_quote">On Mon, Jun 15, 2009 at 7:27 PM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Bradley,<br>
<br>
I re-made your case with:<br>
<br>
mysql> select * from dialplan;<br>
+----+------+----+----------+------------+-----------+------------+----------------+-------+<br>
| id | dpid | pr | match_op | match_exp | match_len | subst_exp |<br>
repl_exp | attrs |<br>
+----+------+----+----------+------------+-----------+------------+----------------+-------+<br>
| 1 | 1 | 0 | 1 | (sip:06.+) | 0 | (sip:06.+) |<br>
\<a href="mailto:1@10.47.19.24">1@10.47.19.24</a> | 0 |<br>
+----+------+----+----------+------------+-----------+------------+----------------+-------+<br>
1 row in set (0.00 sec)<br>
<br>
and in script:<br>
<br>
$var(x) = "sip:061111";<br>
dp_translate("1", "$var(x)/$var(tmp)");<br>
xlog("-------------$var(tmp)\n");<br>
<br>
<br>
The output was:<br>
<br>
Jun 16 03:22:34 [7921] DBG:dialplan:dp_get_ivalue: integer value<br>
Jun 16 03:22:34 [7921] DBG:dialplan:dp_translate_f: dpid is 1<br>
Jun 16 03:22:34 [7921] DBG:dialplan:dp_get_svalue: searching 78<br>
Jun 16 03:22:34 [7921] DBG:dialplan:dp_translate_f: input is sip:061111<br>
Jun 16 03:22:34 [7921] DBG:dialplan:translate: regex operator testing<br>
Jun 16 03:22:34 [7921] DBG:dialplan:test_match: test string sip:061111<br>
<div class="im">against a pattern (sip:06.+)<br>
</div>Jun 16 03:22:34 [7921] DBG:dialplan:test_match: test_match:[0] sip:061111<br>
Jun 16 03:22:34 [7921] DBG:dialplan:test_match: test_match:[1] sip:061111<br>
Jun 16 03:22:34 [7921] DBG:dialplan:translate: found a matching rule<br>
0xb56744c0: pr 0, match_exp (sip:06.+)<br>
Jun 16 03:22:34 [7921] DBG:dialplan:test_match: test string sip:061111<br>
<div class="im">against a pattern (sip:06.+)<br>
</div>Jun 16 03:22:34 [7921] DBG:dialplan:test_match: test_match:[0] sip:061111<br>
Jun 16 03:22:34 [7921] DBG:dialplan:test_match: test_match:[1] sip:061111<br>
Jun 16 03:22:34 [7921] DBG:dialplan:dp_translate_f: input sip:061111<br>
with dpid 1 => output <a href="mailto:sip%3A061111@10.47.19.24">sip:061111@10.47.19.24</a><br>
-------------<a href="mailto:sip%3A061111@10.47.19.24">sip:061111@10.47.19.24</a><br>
<br>
Which looks pretty ok ...<br>
<br>
Maybe there is something something in the correct data in DB.....<br>
<br>
Regards,<br>
<font color="#888888">Bogdan<br>
</font><div><div></div><div class="h5"><br>
<br>
Bradley, Todd wrote:<br>
> Hi, I'm new to openSIPS and am trying to set it up with the dialplan<br>
> module, but I've had a couple problems I can't figure out.<br>
><br>
> The first problem is related to how dp_translate is doing regexp<br>
> replacements. I have code like this in my route method:<br>
><br>
> if (is_method("INVITE")) {<br>
> xlog("To user is: $tu\n");<br>
> xlog("ruri.user is: $ruri.user\n");<br>
> xlog("avp(s:dest) is: $avp(s:dest)\n");<br>
> dp_translate("1", "$tu/$var(tmp)");<br>
> xlog("The variable that came out was $var(tmp)\n");<br>
> setflag(1); # do accounting<br>
> }<br>
><br>
> And my dialplan DB table has this row for dpid 1:<br>
> match_exp=(^06.+)<br>
> subst_exp=(^06.+)<br>
> repl_exp=\<a href="mailto:1@10.47.19.24">1@10.47.19.24</a><br>
><br>
> When I send in a SIP INVITE that is to "sip:061111", I expect the<br>
> dp_translate to convert this to "<a href="mailto:sip%3A061111@10.47.19.24">sip:061111@10.47.19.24</a>". But I just get<br>
> "sip:061111" back. Here's the output:<br>
><br>
> To user is: sip:061111<br>
> ruri.user is: <null><br>
> avp(s:dest) is: <null><br>
> Jun 12 13:48:55 [29901] DBG:dialplan:dp_get_ivalue: integer value<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:dp_translate_f: dpid is 2<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:dp_get_svalue: searching 22<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:dp_translate_f: input is sip:061111<br>
><br>
> Jun 12 13:48:55 [29901] DBG:dialplan:translate: regex operator testing<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:test_match: test string sip:061111<br>
> against a pattern (sip:06.+)<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:test_match: test_match:[0]<br>
> sip:061111<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:test_match: test_match:[1]<br>
> sip:061111<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:translate: found a matching rule<br>
> 0xb610c1f0: pr 2, match_exp (sip:06.+)<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:test_match: test string sip:061111<br>
> against a pattern (sip:06.+)<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:test_match: test_match:[0]<br>
> sip:061111<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:test_match: test_match:[1]<br>
> sip:061111<br>
> Jun 12 13:48:55 [29901] DBG:dialplan:dp_translate_f: input sip:061111<br>
> with dpid 2 => output sip:061111<br>
> The variable that came out was sip:061111<br>
><br>
> So it looks like \1 is indeed replaced with the part that matches the<br>
> regexp, but the rest of my replacement string (the "@<a href="http://10.47.19.24" target="_blank">10.47.19.24</a>" part)<br>
> is ignored. Why is that? What am I doing wrong?<br>
><br>
> And my second question is this: Once I fix my first mistake, what should<br>
> I do to make use of this? The behavior I want is that when the proxy<br>
> gets an INVITE to 061111, it fills in the rest of the address and then<br>
> routes it along. In this case, it should pass it along to<br>
> <a href="mailto:061111@10.47.19.24">061111@10.47.19.24</a>.<br>
><br>
> Here's where my newness to openSIPS is coming to light, I think. When I<br>
> read the documentation for the dialplan module<br>
> (<a href="http://www.opensips.org/html/docs/modules/1.5.x/dialplan.html" target="_blank">http://www.opensips.org/html/docs/modules/1.5.x/dialplan.html</a>), it has<br>
> an example that leads me to believe I should be able to just do this:<br>
><br>
> dp_translate("2", "$avp(s:dest)/$avp(s:dest)");<br>
><br>
> But $avp(s:dest) is null, as you can see from the output above. What<br>
> SHOULD I have in my route script to do what I'm trying to do?<br>
><br>
><br>
> Thanks,<br>
> Todd.<br>
><br>
> ps. I originally posted this question last week to the OpenSIPS web<br>
> forum, but then realized that nobody really reads the forum and all the<br>
> action is over here on the users email list. So sorry for the sort-of<br>
> duplication.<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
><br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div>