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
chrismacOffline



Joined: Mar 29, 2007
Posts: 14

Status: Offline
Posted: Apr 22, 2008 - 03:36 PM Reply with quote Back to top
Hi,

I am trying to build my OpenSER configuration by expanding openser.cfg from 1.3 branch. So far I can't exactly figure out two things in it.

1. What is the point of "exit;" on line 232 if it is preceded by "if () { } else { }" block?
Code:

204: if (has_totag()) {
207:   if (loose_route()) {
       .....
213:   } else {
231:   }
232:   exit;  <----- HOW WE CAN EVER BE HERE?
233: }


2. What is the point of "t_check_trans();" on line 245 if it is not in "if (..)" statement?

Sorry for asking perhaps dummy questions, but want to fully understand openser.cfg supplied with 1.3 before going further with my own config.

The file I am talking about above can be found here:
http://openser.svn.sourceforge.net/viewvc/openser/branches/1.3/etc/openser.cfg?revision=3542&view=markup

Thanks for help in answering my questions.
View user's profile Send private message
micondaOffline



Joined: Feb 02, 2007
Posts: 167

Status: Offline
Posted: Apr 24, 2008 - 03:11 PM Reply with quote Back to top
As the config is designed, messages within a dialog (e.g., that have a To tag) must have a Route header -- if not, then is a broken device or someone trying nasty things. So, drop processing it -- exit.

The second is good to absorb retransmissions.
View user's profile Send private message
chrismacOffline



Joined: Mar 29, 2007
Posts: 14

Status: Offline
Posted: Apr 29, 2008 - 04:50 PM Reply with quote Back to top
Hi,
Thanks for reply. I was more trying to understand logical structure of sample .cfg shipped with OpenSER 1.3.

Lines 204 - 233 it is:
Code:

if (something)
{
  if (A)
  {
    do A;
  }
  else
  {
    do B;
  }
  exit;
}


so once we are inside "something" (has_totag() in our case) we do "A" if (A) or we do "B" in ALL other cases. So logically we will NEVER reach "exit" statement - unless there is something in OpenSER control structures which I don't know/understand.

Again my question about t_check_trans() was because reading: http://www.openser.org/docs/modules/1.3.x/tm.html#AEN480 I assumed all it does is returns bool [true/false]. So why someone would like to use it without "if (t_check_trans()) { do something }" wasn't clear to me. Can you please explain bit more (or point me to documentation) how it is "good to absorb retransmissions".

Many thanks
View user's profile Send private message
x-consoleOffline
Site Admin


Joined: Aug 01, 2006
Posts: 1131
Location: Leeds UK
Status: Offline
Posted: Apr 29, 2008 - 05:39 PM Reply with quote Back to top
Quote:
So logically we will NEVER reach "exit" statement


That is only true if operation A and B both exit the script by some means (relaying the message perhaps, or sending a negative response). if A and B just assign avp values or some other arbitrary task, the exit call will be reached.

Quote:
"if (t_check_trans()) { do something }" wasn't clear to me.


Well, its basically like saying "if the message is part of an existing transaction, then do some stuff, else do other stuff"
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.