[OpenSIPS-Users] var/avp persistence, onreply_route, and script context

Bobby Smith bobby.smith at gmail.com
Fri Aug 5 02:48:19 CEST 2011


All,

Here's why I'm trying to accomplish:

route [subsequent_request] {
   if (has_totag && is_method("ACK") {
     if (MY_VAR = "cisco") {
        lookup("location");
        ... relay and exit
     }
     else {
          ... relay and exit lr
     }
   }
}

onreply_route [foo] {
     ....
     if($ua =~ "Cisco-CP79") {
          MY_VAR = "cisco"
     }
}

The reasons are not really relevant (it's to get rid of a really poor UA
implementation on older Cisco 79XX firmwares), but my intent is:

1) Set a transaction-visible-only value in onreply_route [foo]
2) Retrieve it on the ACK that completes the initial invite transaction.

My problems:

1) if MY_VAR is an $avp, it returns null on retrieving it in the
route[subsequent_request], even with the onreply flag for tm set.
2) if MY_VAR is a $var, it's process global and so, the next transaction
that comes in could share the same state (race)
3) if MY_VAR is a flag, I can't retrieve it in the route [subsequent
request]
4) if MY_VAR is a dlg_flag or a dlg_var, I can't retrieve it in the
subsequent request even if invoking create_dialog as the first action in the
routing script (if it's an initial invite).
5) The only thing I've been able to do is create a unique key via localcache
(with $fU_useragent = myvalue) and fetch it, but this does not allow
multiple UA's to register with the same fU

My question is, is there any way to set a transaction state only value in an
onreply hook, and retrieve it on the ACK?

I know according to the RFC:

      The reason for this separation is rooted in the importance
<http://rfc-ref.org/RFC-TEXTS/3261/kw-importance.html> of
      delivering all 200 (OK) responses to an INVITE
<http://rfc-ref.org/RFC-TEXTS/3261/kw-invite.html> to the UAC
<http://rfc-ref.org/RFC-TEXTS/3261/kw-uac.html>.  To
      deliver them all to the UAC
<http://rfc-ref.org/RFC-TEXTS/3261/kw-uac.html>, the UAS
<http://rfc-ref.org/RFC-TEXTS/3261/kw-uas.html> alone takes
responsibility

      for retransmitting them (see Section 13.3.1.4), and the UAC
<http://rfc-ref.org/RFC-TEXTS/3261/kw-uac.html> alone
      takes responsibility for acknowledging them with ACK
<http://rfc-ref.org/RFC-TEXTS/3261/kw-ack.html> (see Section
      13.2.2.4).  Since this ACK
<http://rfc-ref.org/RFC-TEXTS/3261/kw-ack.html> is retransmitted only
by the UAC <http://rfc-ref.org/RFC-TEXTS/3261/kw-uac.html>, it is
      effectively considered its own transaction
<http://rfc-ref.org/RFC-TEXTS/3261/kw-transaction.html>.



Is there a way to get this associated with the right dialog or something?
 I've tried setting a dialog profile on initial invite, storing a value in
the 200 OK onreply, and retrieving it as well in the ACK, but I get no
dialog has been created (I guess because the dialog is early or something).


Thanks for the ideas,

BobbyS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110804/c770bdd4/attachment-0001.htm>


More information about the Users mailing list