Brekeke Forum Index » Brekeke SIP Server Forum

Post new topic   Reply to topic
How to block codecs in dial plans? *SOLVED*
Author Message
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Mon Sep 17, 2012 10:46 am    Post subject: How to block codecs in dial plans? *SOLVED* Reply with quote

1. Brekeke Product Name and version:
Sip Server 2.x|3.x
2. Java version:
Any
3. OS type and the version:
Any
4. UA (phone), gateway or other hardware/software involved:
N/A
5. Select your network pattern from http://www.brekeke-sip.com/bbs/network/networkpatterns.html :
Any
6. Your problem:

In the dial-plan, how do you block codecs that are unsupported like GSM so they are not passed through the proxy?

Thank you!

Kent C.


Last edited by KentC on Tue Sep 18, 2012 3:38 pm; edited 3 times in total
Back to top
View user's profile
tuie2
Brekeke Talented


Joined: 23 Jan 2009
Posts: 57

PostPosted: Mon Sep 17, 2012 11:59 am    Post subject: Reply with quote

Use $body in the Matching Pattern.

Code:
$body( "(m=audio .+ RTP/AVP.* 3 )" ) = .+


If a SDP indicates GSM (3 is GMS's payloadtype), the above $body matches.
Back to top
View user's profile
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Mon Sep 17, 2012 12:03 pm    Post subject: Reply with quote

Thank you for the help! I will save and test, then update if this is solved!











Kent C.
Back to top
View user's profile
tuie2
Brekeke Talented


Joined: 23 Jan 2009
Posts: 57

PostPosted: Mon Sep 17, 2012 12:03 pm    Post subject: Reply with quote

Refer to the following page. Is is the list of codec payload types.
http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml#rtp-parameters-1
Back to top
View user's profile
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Mon Sep 17, 2012 12:40 pm    Post subject: Reply with quote


Matching Patterns
$addr = *\.*\.*\.*
$request = INVITE
$body = ( "(m=audio .+ RTP/AVP.* 3 )" ) = .+
From = sip:(.+)@

Deploy Patterns
From = sip:(.+)@ To=sip:210xxxxxxx@IP
$rtp = true


When i add the $body, the call fails pretty fast.
I did run a trace and that blocked the call all together. I will test to a different term and see if that works. Does the plan above look ok?


When I remove that $body, call completes.

This is traveling like this:

Orig Carrier > Carrier Proxy > Our Proxy > Term Carrier

I have it configured to go through both proxies. Any additional help is appreciated.
Back to top
View user's profile
tuie2
Brekeke Talented


Joined: 23 Jan 2009
Posts: 57

PostPosted: Mon Sep 17, 2012 2:25 pm    Post subject: Reply with quote

> $body=( "(m=audio .+ RTP/AVP.* 3 )" ) = .+

It is wrong..
It must be
$body( "(m=audio .+ RTP/AVP.* 3 )" ) = .+
Back to top
View user's profile
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Mon Sep 17, 2012 3:41 pm    Post subject: Reply with quote

False Positive. Still not working with dial-pattern addon setup as specified.

Last edited by KentC on Mon Sep 17, 2012 9:18 pm; edited 1 time in total
Back to top
View user's profile
tuie2
Brekeke Talented


Joined: 23 Jan 2009
Posts: 57

PostPosted: Mon Sep 17, 2012 5:32 pm    Post subject: Reply with quote

Very Happy
Back to top
View user's profile
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Mon Sep 17, 2012 9:20 pm    Post subject: Reply with quote

Hey, I retested and found it was taking another rule that was working. I disabled the rule and now those that I thought with that codec that would work aren't.

Can you please advise what else could be the issue.

I tried with a second DID i have configured that works no problem with that code added and it also fails. Any helps is greatly debted. Thank you.


EDIT - When I did a pcap, it's showing '404' not found with that $body string text placed.





Kent C.
Back to top
View user's profile
tuie2
Brekeke Talented


Joined: 23 Jan 2009
Posts: 57

PostPosted: Tue Sep 18, 2012 9:15 am    Post subject: Reply with quote

Can you paste your rules here?

If you are using Brekeke ver3, set "dialplan.debug.log=true" in the Config's Advanced page for debugging DialPlan.
Back to top
View user's profile
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Tue Sep 18, 2012 9:21 am    Post subject: Reply with quote

Code:


Matching Pattern:

$addr=*\.*\.*\.*
$request=INVITE
$body( "(m=audio .+ RTP/AVP.* 3 )" )=.+
From=sip:(.+)@

Deploy Pattern:

To=sip:2102023212@*.*.*.*
$rtp=true


I'm using Brekeke Sip Server v2
Back to top
View user's profile
tuie2
Brekeke Talented


Joined: 23 Jan 2009
Posts: 57

PostPosted: Tue Sep 18, 2012 9:51 am    Post subject: Reply with quote

Are you sure that the INVITE's SDP indicates GSM as a codec?
If not, the above rule doesn't match and "404" will be returned.

Can you paste the SDP part of INVITE here?
Back to top
View user's profile
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Tue Sep 18, 2012 10:40 am    Post subject: Reply with quote

Code:


Here is the filter I ran in wireshark:
sdp.media == "audio 17882 RTP/AVP 18 0 8 101"

Media Description, name and address (m): audio 17882 RTP/AVP 18 0 8 101
                Media Type: audio
                Media Port: 17882
                Media Protocol: RTP/AVP
                Media Format: ITU-T G.729
                Media Format: ITU-T G.711 PCMU
                Media Format: ITU-T G.711 PCMA


I appreciate your help, so the codec has to exist to be blocked or call fails... So if i change that to block like G.711, and test it will work then i assume?


Last edited by KentC on Tue Sep 18, 2012 11:01 am; edited 1 time in total
Back to top
View user's profile
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Tue Sep 18, 2012 11:00 am    Post subject: Reply with quote

Tested with your advice and now the call completes. Does that look right to block G.729? Where can i see if its blocked? Would it show that it's actually blocked on Brekeke or just the INVITE SDP of the trace pcap? I didn't see where to find that.


Code:

$addr=*
$request=INVITE
From=sip:(.+)@
$body( "(m=audio .+ RTP/AVP.* 18 )" )=.+
Back to top
View user's profile
tuie2
Brekeke Talented


Joined: 23 Jan 2009
Posts: 57

PostPosted: Tue Sep 18, 2012 11:52 am    Post subject: Reply with quote

Yes. the payload type 18 means G729.
(See http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml#rtp-parameters-1)


> Where can i see if its blocked?

If the above rule matches, its Deploy Patterns will be executed.


If you want to debug DialPlan rules, I recommend that you use brekeke v3 because it has DialPlan History feature.
Back to top
View user's profile
KentC
Brekeke Guru


Joined: 09 Dec 2011
Posts: 108
Location: rw-rw-rw-

PostPosted: Tue Sep 18, 2012 12:53 pm    Post subject: Reply with quote

Thank you for all your help. I will study this more and try the new version of brekeke.

This is fully resolved.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Brekeke Forum Index » Brekeke SIP Server Forum All times are GMT - 7 Hours
Page 1 of 1