Hello,<br>
<div class="im"><br>
>> The dlg_db_sync command is only useful when you have the second
server online, and want to trigger a refresh of OpenSIPS memory based
on what is in the DB.<br>
<br>
</div>In fact I noticed it. I also tried this test with no success in<br>
fetching the dialog vars:<br>
<br>
1) Server #2 is online listening on 10.0.0.1<br>
2) interface 10.0.0.1 is set down on server #2, but server #2 is not stopped<br>
3) interface 10.0.0.1 is set up on server #1 and server #1 is started<br>
4) UAC sends INVITE to 10.0.0.1, which goes to server #1<br>
5) interface 10.0.0.1 is set down on server #1, and server #1 is stopped<br>
6) interface 10.0.0.1 is set up on server #2<br>
7) dlg_db_sync is run on server #2, but dlg_list_ctx shows no vars<br>
8) UAC sends BYE to 10.0.0.1, which goes to server #2<br>
<div class="im"><br>
>> If you just start the secondary server & do not issue dlg_db_sync, do you still have the same problem ?<br>
<br>
</div>Yes, no dialogs vars in context.<br>
<br>
Attached is the log on server #2 you asked for. It includes the<br>
following, in this order:<br>
<br>
1) opensipsctl start<br>
2) opensipsctl fifo dlg_list_ctx: no vars shown in context<br>
3) opensipsctl fifo dlg_db_sync<br>
4) opensipsctl fifo dlg_list_ctx: no vars shown in context<br>
5) BYE from UAC, server looks for dialog var "caller_tag"<br>
<br>
For this test, I tried to get the vars using fetch_dlg_value(), file<br>
name is log-server-2-from-start-fetch.<div id=":1id">txt.<br>
<br>
I collected another log for the same test, now using get_dialog_info()<br>
instead of fetch_dlg_value(), file name is.<br><br>The files are attached in the previous messages.<br>
<br>
Thanks for the help.</div><br><br><div class="gmail_quote">On Thu, May 17, 2012 at 6:06 AM, Vlad Paiu <span dir="ltr"><<a href="mailto:vladpaiu@opensips.org" target="_blank">vladpaiu@opensips.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div bgcolor="#ffffff" text="#000000"><div class="im">
Hello,<br>
<br>
Just to clear some things up, if you leave the second server offline
and only start it after the active is down, then the ongoing dialogs
will be automatically loaded by the secondary server at startup. The
dlg_db_sync command is only useful when you have the second server
online, and want to trigger a refresh of OpenSIPS memory based on
what is in the DB.<br>
<br>
If you just start the secondary server & do not issue
dlg_db_sync, do you still have the same problem ?<br>
If you can, please send us ( privately or via pastebin ) a full
debug OpenSIPS log of the secondary server ( from startup, until the
moment you want to access a dlg_var ).<br>
<br></div><div class="im">
Regards,<br>
<pre cols="72">Vlad Paiu
OpenSIPS Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a> </pre>
<br></div><div><div class="h5">
On 05/16/2012 08:46 PM, Mariana Arduini wrote:
<blockquote type="cite">Hi Vlad,
<div><br>
</div>
<div>
> Does this also happen if you leave the second server
offline, and start it after the active OpenSIPS is shut down
(...) ?</div>
<div><br>
</div>
<div>Yes, that's exactly the test I've run.</div>
<div><br>
</div>
<div>
> At the moment that you run dlg_db_sync, do you see the
variables in the dialog DB table ?</div>
<div><br>
</div>
<div>Yes.</div>
<div><br>
</div>
<div>
After you run dlg_db_sync, you say you cannot access the
variables from the script, but you see them in dlg_list_ctx ?</div>
<div><br>
</div>
<div>No, I don't see them in dlg_list_ctx, neither I can access
them from the script.</div>
<div><br>
</div>
<div>Thanks.</div>
<div>Mariana.</div>
<div><br>
<div class="gmail_quote">On Wed, May 16, 2012 at 2:31 PM, Vlad
Paiu <span dir="ltr"><<a href="mailto:vladpaiu@opensips.org" target="_blank">vladpaiu@opensips.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#ffffff" text="#000000"> Hi Mariana,<br>
<br>
Does this also happen if you leave the second server
offline, and start it after the active OpenSIPS is shut
down, instead of leaving the second server up and running
'dlg_db_sync' ?<br>
<br>
At the moment that you run dlg_db_sync, do you see the
variables in the dialog DB table ?<br>
After you run dlg_db_sync, you say you cannot access the
variables from the script, but you see them in
dlg_list_ctx ?<br>
<br>
Regards,<br>
<pre cols="72">Vlad Paiu
OpenSIPS Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a> </pre>
<div>
<div> <br>
On 05/16/2012 07:57 PM, Mariana Arduini wrote:
<blockquote type="cite">Hi Razvan,
<div><br>
</div>
<div>Do I need to open a bug about this issue
somewhere? I saw Bogdan's message about OpenSIPS
1.8 Stable being released tomorrow.</div>
<div><br>
</div>
<div>I think the problem is the dialog variables are
not being fetched from DB, either when OpenSIPS is
restarded, either when we run the new fifo command
dlg_db_sync.</div>
<div><br>
</div>
<div>Thanks again!</div>
<div>Mariana.<br>
<div><br>
<div class="gmail_quote">On Wed, May 16, 2012 at
8:06 AM, Mariana Arduini <span dir="ltr"><<a href="mailto:marianarduini@gmail.com" target="_blank">marianarduini@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,
Razvan!
<div><br>
</div>
<div>Thank you for the $DLG_dir
pseudovariable, it worked!</div>
<div><br>
</div>
<div>The variables are properly flushed into
the DB after 200 OK, and I can also see
them using "opensipsctl fifo
dlg_list_ctx", under context.</div>
<div><br>
</div>
<div>Even using the $DLG_dir for the
direction of a sequential request, I still
need to access either the caller_contact
or the callee_contact. Is there any other
way to have those apart from the
variables?</div>
<div><br>
</div>
<div>Thanks again!</div>
<div><span><font color="#888888">Mariana.</font></span>
<div>
<div><br>
<br>
<div class="gmail_quote">On Wed, May
16, 2012 at 5:34 AM, Razvan Crainea
<span dir="ltr"><<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> <tt>Hi,
Mariana!<br>
<br>
Can you check if the variables
are properly flushed into the
DB after 200OK?<br>
Also, if you only want to
check the direction of a
sequential request, you could
use directly the $DLG_dir [1]
pseudovariable from the dialog
module.<br>
<br>
[1] <a href="http://www.opensips.org/html/docs/modules/1.8.x/dialog.html#id295750" target="_blank">http://www.opensips.org/html/docs/modules/1.8.x/dialog.html#id295750</a></tt>
<br>
<tt><br>
Regards,<br>
</tt>
<pre cols="72">--
Răzvan Crainea
OpenSIPS Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
<div>
<div> <br>
On 05/15/2012 10:03 PM,
Mariana Arduini wrote: </div>
</div>
<blockquote type="cite">
<div>
<div>Hello all,
<div><br>
</div>
<div>We need to perform
some substitutions in
the R-URI and Contact
header in order to have
the following flow
working as required:</div>
<div><br>
</div>
<div>caller > opensips1
> opensips2 >
callee</div>
<div><br>
</div>
<div>Currently, opensips1
stores "call_id",
"caller_tag" and
"caller_contact" Dialog
variables using
function
store_dlg_value() on new
INVITES, and
"callee_contact" on 200
OK for the INVITES.
Later, for sequential
requests, it compares
the from_tag with the
caller_tag, accessed
using fetch_dlg_value(),
to find out whether it
is a request from the
caller or from the
callee, and it works.
Then I started working
on failover for
opensips1, and that's
where I'm facing
problems. I'm playing
with
"db_flush_vals_profiles"
new parameter and
"dlg_db_sync" new fifo
command, both on Dialog
module, in order to have
a stand by opensips1
taking over the dialogs
going on in an active
opensips1, in case it
fails. This is the test:
<div> <br>
</div>
<div>1) active opensips
is running listening
on virtual ip say
10.0.0.1</div>
<div>2) caller sends
INVITE to 10.0.0.1,
which goes to active
opensips</div>
<div>3) active opensips
is stopped and it's
virtual ip set
down; same virtual ip
is set up in stand by
opensips and it is
started; fifo command
dlg_db_sync is run on
stand by opensips</div>
<div>4) caller sends BYE
to 10.0.0.1, which
goes to stand by
opensips</div>
<div><br>
</div>
<div>After
loose_route(), stand
by opensips cannot
fetch_dlg_value for
"caller_tag" and the
R-URI is set to
0. Then I tried the
following, using only
one opensips:</div>
<div><br>
</div>
<div>1) caller sends
INVITE to opensips</div>
<div>2) fifo
command dlg_list_ctx
is run and shows all
of the variables I
stored</div>
<div>3) opensips is
restarted and fifo
command dlg_db_sync is
run</div>
<div> 4) fifo
command dlg_list_ctx
is run again and shows
only the dialog info,
not the variables in
context</div>
<div> <br>
</div>
<div>I also
tried get_dialog_info("caller_tag","$var(caller_tag)","call_id","$ci");
and $dlg_val(), but
yet the variables are
not found:</div>
<div><br>
</div>
<div>
<div>
<div> 22232:
DBG:dialog:fetch_dlg_value:
looking for
<caller_tag></div>
<div>22232:
DBG:dialog:fetch_dlg_value:
var NOT found!</div>
<div>22232:
ERROR:core:do_assign:
no value in right
expression</div>
<div>22232:
ERROR:core:do_assign:
error at line: 134</div>
<div>22232: callid(<a href="mailto:1-5150@192.168.16.154" target="_blank">1-5150@192.168.16.154</a>)
trying dlg_val(),
caller_tag: 0</div>
<div>22232:
DBG:core:comp_scriptvar:
str 20 :
uac1192.168.16.154</div>
<div>22232:
DBG:dialog:fetch_dlg_value:
looking for
<caller_contact></div>
<div>22232:
DBG:dialog:fetch_dlg_value:
var NOT found!</div>
<div>22232:
ERROR:core:do_assign:
no value in right
expression</div>
<div>22232:
ERROR:core:do_assign:
error at line: 146</div>
<div>22232: callid(<a href="mailto:1-5150@192.168.16.154" target="_blank">1-5150@192.168.16.154</a>)
trying dlg_val(),
caller_contact: 0</div>
<div>22232:
DBG:tm:t_newtran:
transaction on
entrance=0xffffffffffffffff</div>
<div>22232:
DBG:core:parse_headers:
flags=ffffffffffffffff</div>
<div>22232:
DBG:core:parse_headers:
flags=78</div>
<div>22232:
DBG:tm:t_lookup_request:
start searching:
hash=5130, isACK=0</div>
<div>22232:
DBG:tm:matching_3261:
RFC3261
transaction
matching failed</div>
<div>22232:
DBG:tm:t_lookup_request:
no transaction
found</div>
<div>22232:
ERROR:core:parse_uri:
uri too short:
<0> (1)</div>
<div>22232:
ERROR:core:parse_sip_msg_uri:
bad uri <0></div>
<div>22232:
DBG:core:set_err_info:
ec: 1, el: 3, ei:
'error parsing
r-uri'</div>
<div>22232:
ERROR:tm:new_t:
uri invalid</div>
<div>22232:
ERROR:tm:t_newtran:
new_t failed</div>
</div>
</div>
<div><br>
</div>
<div> There is no error
logs when dlg_db_sync
is run. I see in the
dialog table a column
called from_tag, is
there a way to get its
content for a certain
dialog? It seems the
functions
get_dialog_info(),
fetch_dlg_info() and
$dlg_val() only look
for variables in the
column vars.</div>
<div><br>
</div>
<div>Can anyone see
other type of solution
that does not involve
storing/fetching
dialog variables? I
could take on that.</div>
<div><br>
</div>
<div>I'd really
appreciate any help on
this.</div>
<div><br>
</div>
</div>
<div> This is my cfg file:
<div><br>
</div>
<div>...</div>
<div>
<div>modparam("dialog",
"db_url",
"postgres://opensips:opensips@opensips_db_host:5432/opensips")</div>
<div>modparam("dialog",
"db_mode", 1)</div>
<div>modparam("dialog",
"db_flush_vals_profiles",
1)</div>
</div>
<div>...</div>
<div>
<div>route { </div>
<div>...</div>
<div><span style="white-space:pre-wrap"> </span>if(is_method("INVITE"))
{</div>
<div><span style="white-space:pre-wrap"> </span>create_dialog();</div>
<div><span style="white-space:pre-wrap"> </span>store_dlg_value("caller_tag",
"$ft");</div>
<div> <span style="white-space:pre-wrap"> </span>xlog("L_INFO","Storing
caller_tag: $ft");</div>
<div><span style="white-space:pre-wrap"> </span>store_dlg_value("caller_contact",
"$ct.fields(uri)");</div>
<div><span style="white-space:pre-wrap"> </span>xlog("L_INFO","Storing
caller_contact:
$ct.fields(uri)");</div>
<div><span style="white-space:pre-wrap"> </span>store_dlg_value("call_id",
"$ci");</div>
<div><span style="white-space:pre-wrap"> </span>xlog("L_INFO","Storing
call_id: $ci");</div>
<div>
route(1);</div>
<div> }</div>
</div>
<div>...</div>
<div>
<div>if (has_totag())
{</div>
<div><span style="white-space:pre-wrap"> </span>#
sequential request
withing a dialog
should</div>
<div><span style="white-space:pre-wrap"> </span>#
take the path
determined by
record-routing</div>
<div><span style="white-space:pre-wrap"> </span>if
(loose_route()) {</div>
<div><br>
</div>
<div>
$var(caller_tag) =
$dlg_val(caller_tag);</div>
<div>
xlog("L_INFO","trying
dlg_val(),
caller_tag:
$var(caller_tag)\n");</div>
<div><br>
</div>
<div>
if ($ft ==
$var(caller_tag)) {</div>
<div>
$var(callee_contact)
=
$dlg_val(callee_contact);</div>
<div>
xlog("L_INFO","
trying dlg_val(),
callee_contact:
$var(callee_contact)\n");</div>
<div>
$ru =
$var(callee_contact);</div>
<div>
} else {</div>
<div>
$var(caller_contact)
=
$dlg_val(caller_contact);</div>
<div>
xlog("L_INFO","
trying dlg_val(),
caller_contact:
$var(caller_contact)\n");</div>
<div>
$ru =
$var(caller_contact);</div>
<div>
}</div>
<div> </div>
<div><span style="white-space:pre-wrap"> </span>} </div>
<div><span style="white-space:pre-wrap"> </span>}</div>
<div>
record_route();</div>
<div> if
(!t_relay()) {</div>
<div>
send_reply("500","Internal
Error");</div>
<div> };</div>
<div> exit;</div>
<div>}</div>
<div>...</div>
<div>route[1] {</div>
<div><span style="white-space:pre-wrap"> </span>#
for INVITEs enable
some additional
helper routes</div>
<div><span style="white-space:pre-wrap"> </span>if
(is_method("INVITE"))
{</div>
<div><span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>
$rd="<a href="http://opensips2.domain.com" target="_blank">opensips2.domain.com</a>";</div>
<div>
$rp="5060";<span style="white-space:pre-wrap"><br>
</span></div>
<div><br>
</div>
<div> #
Change Contact
header</div>
<div> if
(subst('/^Contact\s*:\s*("[^"]*")?\s*<?sip:(([^@]*)@)?([^;>]*)((;[^;>]*)*)>?(.*)/Contact:
<<a href="mailto:sip%3Aplain@my.domain.com" target="_blank">sip:plain@my.domain.com</a>\5>\7/ig'))
{</div>
<div>
xlog("L_DBG","CONTACT
was modified");</div>
<div> }</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"> </span>
t_on_reply("2");</div>
<div><span style="white-space:pre-wrap"> </span>}</div>
<div><br>
</div>
<div>}</div>
<div>...</div>
<div>onreply_route[2]
{</div>
<div><br>
</div>
<div>
if(is_present_hf("Contact"))
{</div>
<div>
xlog("L_INFO","
Storing
callee_contact:
$ct.fields(uri)");</div>
<div>
store_dlg_value("callee_contact",
"$ct.fields(uri)");</div>
<div> }</div>
<div><br>
</div>
<div> if
(subst('/^Contact\s*:\s*("[^"]*")?\s*<?sip:([^@]*)@[^;>]*((;[^;>]*)*)>?(.*)/Contact:
<sip:\<a href="mailto:2@my.domain.com" target="_blank">2@my.domain.com</a>\3>\5/ig'))
{</div>
<div>
xlog("L_DBG","CONTACT
was modified");</div>
<div> } </div>
<div>}</div>
</div>
<div>
<div>...</div>
</div>
</div>
<div><br>
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">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>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
<pre><fieldset></fieldset>
_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
</div>
</div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">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>
</blockquote>
</div>
<br>
</div>
<pre><fieldset></fieldset>
_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div></div></div>
<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></blockquote></div><br>