SearchSearch  Log in to check your private messagesLog in to check your private messages  recent posts Recent Posts
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
drhooksonOffline



Joined: Mar 10, 2008
Posts: 8

Status: Offline
Posted: Apr 16, 2008 - 10:39 AM Reply with quote Back to top
high.*!

i'm using openser v1.2 and am a bit confused about the scope of the flag. just for information about my setup: i use openser as gateway between OCSmediation server and asterisk.

i learned that the message flags are transaction persistent, which means that if i set some flags while processing the INVITE request, these flags must be visible also when we process all other requests and replies in scope of the same transaction.

and i also learned, that the flags which are set for INVITE are visible only when processing 100 (Trying), 180 (Ringing), and 487 (Request Cancelled). however, the flags are not visible when processing CANCEL, 200 (OK), and ACK.

thats for the theory.

now i have two problems:
first (as i mentioned above) i experienced, that 'my' flags are not that visible as they should be. means e.g. i set flag 3 in request route and print it out in onreply_route, where it seems not to be set.
see my code below:
Code:

route {
...
  if (src_ip == 172.23.26.121)
    t_relay("udp:172.xx.xx.xx:5060");
  else
    t_relay("tcp:172.xx.xx.xx:5060");

  if (method == INVITE) setflag(3);
  xlog("L_INFO","$Cybmf=$mf, bf=$bf, sf=$sf$Cxx\n");
  exit;
}
onreply_route {
  xlog("L_INFO","$Cyr$rs($rr): mf=$mf, bf=$bf, sf=$sf$Cxx\n");
}


the output is the following
Code:

10(10457) INVITE: mf=8, bf=0, sf=0
 6(10453) 100(Trying): mf=0, bf=0, sf=0
 7(10454) 180(Ringing): mf=0, bf=0, sf=0
 8(10455) 200(OK): mf=0, bf=0, sf=0
10(10457) ACK: mf=0, bf=0, sf=0
 5(10452) BYE: mf=0, bf=0, sf=0
11(10458) 200(OK): mf=0, bf=0, sf=0


as you can see the flag 3 is only set, while processing the INVITE but after this is stays reset.

any ideas which problem i'm facing here?


my second problem is, that i need to identify the reply "200 OK" which is answered to the relayed INVITE message. as i mentioned above, this will not be covered by the flags scope anyways. Sad
is there any possibility to have kind of (real) global variables in openser.cfg?

thx & cheers
-hugo
View user's profile Send private message
x-consoleOffline
Site Admin


Joined: Aug 01, 2006
Posts: 1130
Location: Leeds UK
Status: Offline
Posted: Apr 16, 2008 - 12:02 PM Reply with quote Back to top
Quote:
is there any possibility to have kind of (real) global variables in openser.cfg?

yes, using gflags

Also, script variables are persistent across transactions (or more accurately, they are stored within the process heap for that particular openser process). AVP's are persistent within a transaction (assuming OpenSER is in stateful mode.. that is the TM module is in use). They are linked to the transaction once the transaction is created, and they are deallocated once the transaction is complete.

As for regular flags, there are three types; script flags, branch flags, and message flags. script flags are per-script instance (by that i mean once the top-level route has been exited, these are lost). branch flags are per-transaction persistent, but for a specific branch, and message flags are per-transaction persistent for all branches. Note: as of 1.3 CANCEL is not treated as a separate transaction, so flags will be inherited.

As for why your script does not show the message flag as set.. i'm not entirely sure, but can you test each in-transaction message with isflagset() ? It might be that the pseudovariable you are referencing is not being set correctly..
View user's profile Send private message Yahoo Messenger
drhooksonOffline



Joined: Mar 10, 2008
Posts: 8

Status: Offline
Posted: Apr 17, 2008 - 01:56 PM Reply with quote Back to top
thx for the hint to the gflags, is exactly what i need. Smile

btw. i resolved the issue with the flag scope. the problem was that the setflag must always be issued before a t_relay, unless one is using the function t_flush_flags (from tm module).

cheers
-hugo
View user's profile Send private message
x-consoleOffline
Site Admin


Joined: Aug 01, 2006
Posts: 1130
Location: Leeds UK
Status: Offline
Posted: Apr 17, 2008 - 02:27 PM Reply with quote Back to top
d'oh! I missed that in your config snippet.
View user's profile Send private message Yahoo Messenger


View previous topic Printable version Log in to check your private messages View next topic

Post new topic   Reply to topic
Forum Rules and Guidelines | About VoIP User | Privacy Policy


All logos and trademarks in this site are property of their respective owner.
Comments and posts are property of the poster, all the rest (c) 2003-2006 VoIP User.

No part of this site may be reproduced without our prior consent.