Re: [SR-Users] How does save(location) choose the subscriber

2013-05-24 Thread Alex Balashov

On 05/24/2013 11:58 AM, Mino Haluz wrote:


if I do save(location) when receiving REGISTER, what is the header
which indicates the subscriber for which it will be registered ?


According to RFC 3261, the To header (To URI) contains the AoR (Address 
of Record) that the UAC desires to register.


--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] How does save(location) choose the subscriber

2013-05-24 Thread Mino Haluz
Hi,

if I do save(location) when receiving REGISTER, what is the header which
indicates the subscriber for which it will be registered ?

$fu?$au?$tu?

Thanks,
Mino
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] LCR Module - Rule_id

2013-05-24 Thread Eloy Coto Pereiro
Hi Juha,


Many thanks, finally with lcr_id is ok. I make a few changes in my config
and work ok.

Cheers


On Fri, May 17, 2013 at 3:02 PM, Juha Heinanen  wrote:

> Eloy Coto Pereiro writes:
>
> > Any solution to check the rule extra info. I want route billing info to
> put
> > in the acc. Any standar solution?
>
> i quickly looked the code and seems like rule_id would need to be added
> to matched_gw_info struct when load_gws() is called and copied from
> there as a new field to gw_uri_avp. then when next_gw() is called,
> rule_id stored with matched gw would need to be copied from the gw's
> matched_gw_info struct to a new rule_id_avp.
>
> -- juha
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] [sr-dev] Via header, branch parameter and syn_branch

2013-05-24 Thread Henning Westerholt
Am Donnerstag, 23. Mai 2013, 12:20:00 schrieb Henning Westerholt:
> [...]
> > And should the next major release have a default of syn_branch=0?
> > Since with syn_branch=1 the branch=0 version has been known to cause
> > interop issues in the past (see below) and I can confirm the
> > branch=z9hG4bKcydzigwkX version causes interop issues in the present.
> 
> Hello Richard,
> 
> syn_branch=0 should be made the default, this is what we use as default
> since years in our backend. The performance concerns that were the reason
> for introducing it long ago are nowadays not valid anymore (even on
> embedded systems).
> 
> I would suggest to remove this parameter completely, one less if/else case
> in the module code and also a a parameter less to document and learn for
> our users.

Hello Richard,

the parameter has been removed from the core in git master branch. Now 
Kamailio should be generate correct Via branch parameter as default. It 
behaves now as syn_branch = 0 would be set.

Cheers,

Henning Westerholt


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Calls remain stuck in state 1

2013-05-24 Thread Daniel-Constantin Mierla

Hello,

3.1 is rather old for dialog module, you should upgrade to more recent 
version because dialog got lot of work.


The general hint is that you have to create the dialog as last operation 
before t_relay().


Cheers,
Daniel

On 5/24/13 11:05 AM, Giany wrote:

Hello,

We are using dipatcher to limit the concurrent number of calls, 
problem is that from time to time
 calls remain stuck in state 1 and it breaks our concurrent limits..I 
was not able to make a kamailio

log with high debug as it happens randomly. Attached is a tcpdump flow:

Conv.| Time| serverA | Provider   
 |

 |   |   | RemoteEnd |
112  |938.355  | INVITE SDP (g729 g711U GSM X-NSERTPType-100 
te...hone-eventRT)

 |   |(5060)   -->  (5050)   | |
112  |938.357  | 100 Trying|   |   |
 |   |(5050)   -->  (5060)   | |
113  |938.420  | INVITE SDP (g711U g729 
telephone-eventRTPType-...)|

 |   |(5050)   -->  (5060)   | |
113  |938.422  | 100 trying -- your call is important to us   
 |

 |   |(5060)   -->  (5050)   | |
113  |938.422  | INVITE SDP (g711U g729 
telephone-eventRTPType-...)|

 |   |(5060)   -->  (1416)   | |
113  |938.908  | INVITE SDP (g711U g729 
telephone-eventRTPType-...)|

 |   |(5060)   -->  (1416)   | |
113  |939.908  | INVITE SDP (g711U g729 
telephone-eventRTPType-...)|

 |   |(5060)   -->  (1416)   | |
113  |941.906  | INVITE SDP (g711U g729 
telephone-eventRTPType-...)|

 |   |(5060)   -->  (1416)   | |
113  |945.907  | INVITE SDP (g711U g729 
telephone-eventRTPType-...)|

 |   |(5060)   -->  (1416)   | |
112  |948.358  | CANCEL|   |   
|SIP Request

 |   |(5060) <--  (61016)  |
112  |948.359  | CANCEL|   |   
|SIP Request

 |   |(5060)   -->  (5050)   | |
112  |948.359  | 200 canceling |   
|SIP Status

 |   |(5060) -->  (61016)  |
112  |948.359  | 487 Request Terminated  | 
  |SIP Status

 |   |(5050)   -->  (5060)   | |
112  |948.359  | 200 OK|   |   
|SIP Status

 |   |(5050)   -->  (5060)   | |
112  |948.359  | ACK   |   |   
|SIP Request

 |   |(5060)   -->  (5050)   | |
112  |948.360  | 487 Request Terminated|   
|SIP Status

 |   |(5060) -->  (61016)  |
113  |948.360  | CANCEL|   |   
|SIP Request

 |   |(5050)   -->  (5060)   | |
113  |948.360  | 200 canceling |   
|SIP Status

 |   |(5060)   -->  (5050)   | |
112  |948.365  | ACK   |   |   
|SIP Request

 |   |(5060) <--  (61016)  |


dialog::  hash=136:689416016
 state:: 1
 ref_count:: 3
 timestart:: 0
 timeout:: 0
 callid:: 745eed805cad6b9a3e1727d169cf3461@serverA:5050
 from_uri:: sip:fromnumber@serverA:5050
 from_tag:: as53f6bee4
 caller_contact:: sip:fromnumber@serverA:5050
 caller_cseq:: 102
 caller_route_set::
 caller_bind_addr:: udp:serverA:5060
 callee_bind_addr::
 to_uri:: sip:internalnr@serverA:5060
 to_tag::
 callee_contact::
 callee_cseq::
 callee_route_set::
As you see the remoteEnd does not answer at all to this request (due to network 
issue most likely)
and the provider sends a CANCEL after approx 3 seconds.
 From what I see the INVITE that is sent from asterisk towards kamailio
  remains stuck(938.420).
We are using Kamailio 3.1.6.Any idea what could be the reason for this?

Thank you.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
  * http://asipto.com/u/katu *

___
SIP Expres

Re: [SR-Users] misc_radius false error

2013-05-24 Thread Victor V. Kustov
Hello, Daniel-Constantin!

I see attached two patches:

docs.patch - some documentation changes

functions.patch: 
+ patch 'bout IPv4 (ipaddr) attributes
+ in radius_load_callee_avps/radius_load_caller_avps when
  common_response set 1, avp's set even in negative radius response
  (usable for error handle).


Looks like I successfully combine kamailio and abills via radius.

--
 WBR, Victor
  JID: coy...@bks.tv
  JID: coy...@bryansktel.ru
  I use FREE operation system: 3.9.2-calculate GNU/Linux
diff --git a/modules/misc_radius/functions.c b/modules/misc_radius/functions.c
index 7a2468b..50c63cf 100644
--- a/modules/misc_radius/functions.c
+++ b/modules/misc_radius/functions.c
@@ -196,11 +196,12 @@ static void generate_avps(struct attr *attrs, VALUE_PAIR* received)
 	do {\
 		if ((_len) != 0) {		\
 			if ((_len) == -1) {		\
-if (_attrs[_attr].t != PW_TYPE_INTEGER) {		\
-	LM_ERR("attribute %d is not of type integer\n",	\
-			_attrs[_attr].v);\
-	goto error;		\
-}			\
+if (_attrs[_attr].t != PW_TYPE_INTEGER) \
+if (_attrs[_attr].t != PW_TYPE_IPADDR) { 		\
+LM_ERR("attribute %d is not of type integer or ipaddr\n",	\
+_attrs[_attr].v);\
+goto error;		\
+ }			\
 			}\
 			if (!rc_avpair_add( rh, &send, _attrs[_attr].v, _val, _len, 0)) { \
 LM_ERR("failed to add %s, %d\n", _attrs[_attr].n, _attr); \
@@ -274,6 +275,7 @@ int radius_load_caller_avps(struct sip_msg* _m, char* _caller, char* _s2)
 		return 1;
 	} else {
 		rc_avpair_free(send);
+   if (common_response) generate_avps_rad(received);
 		rc_avpair_free(received);
 #ifdef REJECT_RC
 		if (res == REJECT_RC) {
@@ -359,6 +361,7 @@ int radius_load_callee_avps(struct sip_msg* _m, char* _callee, char* _s2)
 		return 1;
 	} else {
 		rc_avpair_free(send);
+   if (common_response) generate_avps_rad(received);
 		rc_avpair_free(received);
 #ifdef REJECT_RC
 		if (res == REJECT_RC) {
diff --git a/modules/misc_radius/doc/misc_radius_admin.xml b/modules/misc_radius/doc/misc_radius_admin.xml
index aff0973..d39cd06 100644
--- a/modules/misc_radius/doc/misc_radius_admin.xml
+++ b/modules/misc_radius/doc/misc_radius_admin.xml
@@ -307,18 +307,35 @@ modparam("misc_radius", "use_sip_uri_host", 1)
 		common_response (integer)
 		
 		Set it to 1 if you need common radius response attributes to
-		be added as AVPs.
+		be added as AVPs in radius_load_caller_avps
+and radius_load_callee_avps
+with name as radius attribute name and value as radius attribute value.
 		
 		
 		Default value is 0.
 		
 		
-		common_response parameter usage
+		radius responce with common_response value 1
 		
+modparam("misc_radius", "common_response", 1)
 ...
-modparam("misc_radius", "common_response", 21)
+radius_load_caller_avps($fU);
 
-		
+Sending Access-Accept of id 60 to 192.168.25.32 port 59736
+Session-Timeout = 4261674
+next-hop-ip = "SIP/00111222333444@cisco-out"
+SIP-AVP = "email:sr-users@lists.sip-router.org session-timeout#161 next-hop-ip:h323/0001...@myvoip-gate.kamailio.org"
+session-protocol = "SIP"
+
+$avp(Session-Timeout) has integer value 4261674
+$avp(next-hop-ip) has string value "SIP/00777888@cisco-out"
+$avp(session-protocol) has string value "SIP"
+$avp(SIP-AVP) has string value  "email:sr-users@lists.sip-router.org session-timeout#161 next-hop-ip:h323/0001...@myvoip-gate.kamailio.org"
+
+When recieving negative response, check appropriate avp's:
+$avp(Reply-Message) = "Not enough money on deposit '-89.83'. Rejected"
+$avp(Filter-Id) = "neg_deposit"
+
 	
 
 	
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] [sr-dev] "SER Getting Started" - what's the copyright and license?

2013-05-24 Thread Henning Westerholt
Am Donnerstag, 23. Mai 2013, 09:56:46 schrieb Olle E. Johansson:
> http://kamailio.org/docs/ser-getting-started/SER-GettingStarted.pdf
> 
> I'm looking for the authors of this document to find out what license it is
> published under. It would be nice to be able to use it and update it
> instead of starting a new "getting started" from scratch.
> 
> Please contact me if you get this message!

Hello Olle,

you've probably contacted them already, for reference this were the authors of 
this document in the past:

Paul Hazlett, phazlett at gmail dot com
Simon Miles, simon at SystemsRM dot co dot uk>
Greger V. Teigre, greger at teigre dot com

Best regards,

Henning Westerholt

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Calls remain stuck in state 1

2013-05-24 Thread Giany
Hello,

We are using dipatcher to limit the concurrent number of calls, problem is that 
from time to time
 calls remain stuck in state 1 and it breaks our concurrent limits..I was not 
able to make a kamailio
log with high debug as it happens randomly. Attached is a tcpdump flow:

Conv.| Time    | serverA                         | Provider                     
   |
     |         |                   | RemoteEnd     |                   
112  |938.355  |         INVITE SDP (g729 g711U GSM X-NSERTPType-100 
te...hone-eventRT)          
     |         |(5060)   -->  (5050)   |                   |
112  |938.357  |         100 Trying|                   |                   |
     |         |(5050)   -->  (5060)   |                   |
113  |938.420  |         INVITE SDP (g711U g729 telephone-eventRTPType-...)|
     |         |(5050)   -->  (5060)   |                   |
113  |938.422  |         100 trying -- your call is important to us        |
     |         |(5060)   -->  (5050)   |                   |
113  |938.422  |         INVITE SDP (g711U g729 telephone-eventRTPType-...)|
     |         |(5060)   -->  (1416)   |                   |
113  |938.908  |         INVITE SDP (g711U g729 telephone-eventRTPType-...)| 
     |         |(5060)   -->  (1416)   |                   |
113  |939.908  |         INVITE SDP (g711U g729 telephone-eventRTPType-...)|
     |         |(5060)   -->  (1416)   |                   |
113  |941.906  |         INVITE SDP (g711U g729 telephone-eventRTPType-...)|
     |         |(5060)   -->  (1416)   |                   |
113  |945.907  |         INVITE SDP (g711U g729 telephone-eventRTPType-...)|
     |         |(5060)   -->  (1416)   |                   |
112  |948.358  |         CANCEL    |                   |                   |SIP 
Request
     |         |(5060)   <--  (61016)  |
112  |948.359  |         CANCEL    |                   |                   |SIP 
Request
     |         |(5060)   -->  (5050)   |                   |
112  |948.359  |         200 canceling                 |                   |SIP 
Status
     |         |(5060)   -->  (61016)  |
112  |948.359  |         487 Request Terminated          |                 |SIP 
Status
     |         |(5050)   -->  (5060)   |                   |
112  |948.359  |         200 OK    |                   |                   |SIP 
Status
     |         |(5050)   -->  (5060)   |                   |
112  |948.359  |         ACK       |                   |                   |SIP 
Request
     |         |(5060)   -->  (5050)   |                   |
112  |948.360  |         487 Request Terminated        |                   |SIP 
Status
     |         |(5060)   -->  (61016)  |
113  |948.360  |         CANCEL    |                   |                   |SIP 
Request
     |         |(5050)   -->  (5060)   |                   |
113  |948.360  |         200 canceling                 |                   |SIP 
Status
     |         |(5060)   -->  (5050)   |                   |
112  |948.365  |         ACK       |                   |                   |SIP 
Request
     |         |(5060)   <--  (61016)  |


dialog::  hash=136:689416016 state:: 1 ref_count:: 3 timestart:: 0 timeout:: 0 
callid:: 745eed805cad6b9a3e1727d169cf3461@serverA:5050 from_uri:: 
sip:fromnumber@serverA:5050
from_tag:: as53f6bee4
caller_contact:: sip:fromnumber@serverA:5050
caller_cseq:: 102
caller_route_set::
caller_bind_addr:: udp:serverA:5060
callee_bind_addr::
to_uri:: sip:internalnr@serverA:5060
to_tag::
callee_contact::
callee_cseq::
callee_route_set::

As you see the remoteEnd does not answer at all to this request (due to network 
issue most likely)
and the provider sends a CANCEL after approx 3 seconds.
>From what I see the INVITE that is sent from asterisk towards kamailio remains 
>stuck (938.420).
We are using Kamailio 3.1.6. Any idea what could be the reason for this? 

Thank you.___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] TLS and SIP

2013-05-24 Thread Daniel-Constantin Mierla

Hello,

On 5/23/13 5:47 PM, Klaus Darilion wrote:

Hi Fabian!

See http://www.kamailio.org/wiki/tutorials/tls/testing-and-debugging 
for TLS debugging.


fix_nated_contact() is old-style NAT traversal. It basically works, 
but is a bit intrusive and may cause problems with strict clients. 
Nowadays add_contact_alias() and handle_ruri_alias() is the preferred 
method.
fyi, the latest default config file uses this approach with contact/uri 
alias, so you may look at it and see how to replace the old approach 
that replaced the contact address.


Cheers,
Daniel



If you can not disable the ALG and run into problems, it may be 
possible to bypass the ALG by using a different port instead port 5060.


regards
Klaus

On 23.05.2013 15:59, Fabian Borot wrote:
Thank you guys, I added this line "fix_nated_contact();" and it made 
the trick. Unfortunately I can not change the SIP-ALG on the firewall.
I am curious about the null cipher option, is there an example of the 
TLS configuration tutorials?

thank you again



Date: Thu, 23 May 2013 10:13:35 +0200
From: klaus.mailingli...@pernau.at
To: fbo...@hotmail.com
CC: sr-users@lists.sip-router.org
Subject: Re: [SR-Users] TLS and SIP



On 22.05.2013 15:49, Fabian Borot wrote:

Thank you Klaus, good idea, but I forgot to mention that when I
configure the client w/o TLS using regular SIP/UDP/5060 I dont have
that problem. When the BYE from the called side comes it is sent to
the calling side without any problems. But I do see that the Contact
and VIA reach the Proxy with Public IP:Ports (our NAT automatically
changes the internal IP/ports by the Public ones really well). The
IP:Port in the VIA, CONTACT are the same that the request brings at
layer3 and 4 as well. So I don't bother doing the extra NAT
configuration in the office. Maybe since the actual content of the
TLS SIP call is encrypted the firewall does not change the and then
they should reach the proxy with the private IP:Ports, causing this
problem.


I think you just found the problem yourself. History showed that NAT
traversal in the proxy is much more reliable then using the SIP-ALG in
the firewall.

Thus, if you start using NAT traversal in the proxy, it would be 
good to

disable the SIP-ALG in the firewall, as this often causes problems when
multiple nodes try to be smart.


I will try TCP and also adding some extra NAT handling configuration
to the proxy.


I would suggest to disable the SIP-ALG in the NAT/firewall. Then start
with UDP and TCP, and if the they work switch to TLS.

Using the NULL cipher as suggested by Daniel is a good idea, but
requires that your client allows to configure the TLS cipher.

regards
Klaus




thank you again







Date: Wed, 22 May 2013 10:14:15 +0200 From:
klaus.mailingli...@pernau.at To: sr-users@lists.sip-router.org CC:
fbo...@hotmail.com Subject: Re: [SR-Users] TLS and SIP



On 21.05.2013 21:54, Fabian Borot wrote:

Hi

I am using Kamailio 4.0.1 in front of an asterisk servers farm to
handle TLS with our clients and providers. The idea is to have
kamailio "talking" SIP/UDP/5060 and TLS/TCP/5061 with the
customers and providers and regular SIP/UDP/5060 with our
internal asterisk servers.

So far at least for the customers it looks like it can work. But
I have a problem, when the call is established and the called
person hangs up, the BYE from the called person to the calling
person is ignored. Only when the calling person hangs up first
the call is terminated properly.

This is what I have been able to see:

1- Customer starts the TLS handshake/connection. 2- Kamailio
authenticate it, then routes the call to the asterisk server
using regular SIP/UDP/5060 but I see that it is inserting 2
Record Routes in the INVITE:

Record-Route: 

Record-Route: 

3- The Contact on that INVITE to the asterisk also comes like
this:

Contact: 


Next time please show the whole message (without SDP) as Via would
be interesting too.


4- The ACK sent to the asterisk once it accepts the call (200 OK)
also has those 2 Record-Routes:

Record-Route: 

Record-Route: 

5- The call is established, once the called person decides to
hang up the BYE looks like this:

BYE sip:94167032@172.31.196.21:53325;transport=tls SIP/2.0 Via:
SIP/2.0/UDP 192.168.1.59:5060;branch=z9hG4bK40fa1c23;rport Route:
, 





Max-Forwards: 70

From: ;tag=as37953869 To: "kamailio"
;tag=788cd7c892df40f3b1967112395e2ca4
Call-ID: f9fe65daf1074219be26cb0c224339f1 CSeq: 102 BYE
User-Agent: Asterisk PBX 11.3.0 X-Asterisk-HangupCause: Normal
Clearing X-Asterisk-HangupCauseCode: 16 Content-Length: 0

My kamailio TLS config is shown below:

enable_tls=yes

loadmodule "tls.so"

# - tls params - modparam("tls", "config",
"/usr/local/kamailio-4.1//etc/kamailio/tls.cfg") modparam("tls",
"private_key", "./privkey.pem") modparam("tls", "certificate",
"./kamailio1_cert.pem") modparam("tls", "ca_list",
"./calist.pem") modparam("tls", "verify_certificat

Re: [SR-Users] Simulating kamailio config flows

2013-05-24 Thread Daniel-Constantin Mierla

Hello,

right direction, but maybe the change is not required everywhere or 
maybe inside some functions, you have to analyze where is pvar and where 
is ser-style avp.


Cheers,
Daniel

On 5/24/13 9:22 AM, Victor Seva wrote:

2013/5/23 Victor Seva :

2013/5/23 Daniel-Constantin Mierla :

- update the interpreter to use pv cache instead of own spec per pv (I can
do it, being in my list and hopefully is no big change)

I will try to do it myself just to get familliar with this area. Let's
see how it goes.

You mean modifiing cfg.y on:

pvar: PVAR {
pv_spec=pkg_malloc(sizeof(*pv_spec));
if (!pv_spec) {
yyerror("Not enough memory");
YYABORT;
}
memset(pv_spec, 0, sizeof(*pv_spec));
s_tmp.s=$1; s_tmp.len=strlen($1);
if (pv_parse_spec(&s_tmp, pv_spec)==0){
yyerror("unknown script pseudo variable %s", $1 );
pkg_free(pv_spec);
pv_spec=0;
YYABORT;
}
$$=pv_spec;
}
;

avp_pvar: AVP_OR_PVAR {
lval_tmp=pkg_malloc(sizeof(*lval_tmp));
if (!lval_tmp) {
yyerror("Not enough memory");
YYABORT;
}
memset(lval_tmp, 0, sizeof(*lval_tmp));
s_tmp.s=$1; s_tmp.len=strlen(s_tmp.s);
if (pv_parse_spec2(&s_tmp, &lval_tmp->lv.pvs, 1)==0){
/* not a pvar, try avps */
/* lval_tmp might be partially filled by the failed
   pv_parse_spec2() (especially if the avp name is the
   same as a pv class) => clean it again */
memset(lval_tmp, 0, sizeof(*lval_tmp));
lval_tmp->lv.avps.type|= AVP_NAME_STR;
lval_tmp->lv.avps.name.s.s = s_tmp.s+1;
lval_tmp->lv.avps.name.s.len = s_tmp.len-1;
lval_tmp->type=LV_AVP;
}else{
lval_tmp->type=LV_PVAR;
}
$$ = lval_tmp;
DBG("parsed ambigous avp/pvar \"%.*s\" to %d\n",
s_tmp.len, s_tmp.s, lval_tmp->type);
}
;

Not malloc pv_spec and instead use pv_cache_get()?

Cheers,
Victor


--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
  * http://asipto.com/u/katu *


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Simulating kamailio config flows

2013-05-24 Thread Victor Seva
2013/5/23 Victor Seva :
> 2013/5/23 Daniel-Constantin Mierla :
>> - update the interpreter to use pv cache instead of own spec per pv (I can
>> do it, being in my list and hopefully is no big change)
>
> I will try to do it myself just to get familliar with this area. Let's
> see how it goes.

You mean modifiing cfg.y on:

pvar: PVAR {
pv_spec=pkg_malloc(sizeof(*pv_spec));
if (!pv_spec) {
yyerror("Not enough memory");
YYABORT;
}
memset(pv_spec, 0, sizeof(*pv_spec));
s_tmp.s=$1; s_tmp.len=strlen($1);
if (pv_parse_spec(&s_tmp, pv_spec)==0){
yyerror("unknown script pseudo variable %s", $1 );
pkg_free(pv_spec);
pv_spec=0;
YYABORT;
}
$$=pv_spec;
}
;

avp_pvar: AVP_OR_PVAR {
lval_tmp=pkg_malloc(sizeof(*lval_tmp));
if (!lval_tmp) {
yyerror("Not enough memory");
YYABORT;
}
memset(lval_tmp, 0, sizeof(*lval_tmp));
s_tmp.s=$1; s_tmp.len=strlen(s_tmp.s);
if (pv_parse_spec2(&s_tmp, &lval_tmp->lv.pvs, 1)==0){
/* not a pvar, try avps */
/* lval_tmp might be partially filled by the failed
  pv_parse_spec2() (especially if the avp name is the
  same as a pv class) => clean it again */
memset(lval_tmp, 0, sizeof(*lval_tmp));
lval_tmp->lv.avps.type|= AVP_NAME_STR;
lval_tmp->lv.avps.name.s.s = s_tmp.s+1;
lval_tmp->lv.avps.name.s.len = s_tmp.len-1;
lval_tmp->type=LV_AVP;
}else{
lval_tmp->type=LV_PVAR;
}
$$ = lval_tmp;
DBG("parsed ambigous avp/pvar \"%.*s\" to %d\n",
s_tmp.len, s_tmp.s, lval_tmp->type);
}
;

Not malloc pv_spec and instead use pv_cache_get()?

Cheers,
Victor

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users