Notify by email when remote server returns 486 BUSY

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
dstu
Posts: 72
Joined: Mon Feb 06, 2006 3:56 am

Notify by email when remote server returns 486 BUSY

Post by dstu »

1. Brekeke Product Name and Version:
Brekeke SIP Server , Version 3.1.9.0 Advanced

2. Java version:
Tomcat 6.0.35.0

3. OS type and the version:
Debian Linux 6.0

4. UA (phone), gateway or other hardware/software involved:

5. Your problem:
I would like to be notified by when a certain remote server returns 486 BUSY to an INVITE request.
I was told to create a HEARTBEAT and then to "add an action" of sending an email, but a heartbeat seems to me like a new message I send (with predefined interval), but it's not what I want. I want normal INVITEs being sent normally that are answered by BUSY (should never happen from this specific destination server) to be alerted.
How do I do that?

Thanks.
Harold
Posts: 289
Joined: Sun Sep 21, 2008 10:31 pm
Location: Japan

Post by Harold »

The HeatBeat doesn't send normal INVITE.
The session plugin will meet the requirement but you need to write a code.
dstu
Posts: 72
Joined: Mon Feb 06, 2006 3:56 am

Post by dstu »

Harold wrote:The HeatBeat doesn't send normal INVITE.
That's what I said. I don't expect the heartbeat to send anything. I want to capture busy responses, just like in example 4 in this page and except for rerouting, to be notified:
http://wiki.brekeke.com/wiki/How-to-mak ... -Dial-Plan
Harold wrote:The session plugin will meet the requirement but you need to write a code.
Can you assist with that? Are there any examples available?

Thanks
james
Posts: 501
Joined: Mon Dec 10, 2007 12:56 pm

Post by james »

Create a new file "config.properties" in <Tomcat>/webapps/sip/WEB-INF/work/sv.

And put the line below in the file.

Code: Select all

com.brekeke.siptool.haman.HeartbeatSIP.SIP_METHOD=INVITE
Save the file and restart the SIP Server.

Now the SIP server sends INVITE instead of OPTIONS.
voipwell.com
Posts: 528
Joined: Tue Sep 20, 2005 9:10 am
Location: Tannersville, Pennsylvania

Post by voipwell.com »

email alert when Any call to a specific IP returns busy.
Is that what you are looking for?

We had a similar needed to email alert when a deivice failed registration so we could see if anyone is trying to hack. We used windowsh shell program to check the Brekeke log file every 30 seconds for new failed registrations and email alert. Each pass knew where the other left off so only new failures were emailed.

In linux using tail it's much easier than windows. a simple shell looping thru the Brekeke call log pattern mathing 486 busy as it appears in the log should be able to email you. I guess you could write a plugin to do the same thing live in java.

If you are comfortable in the dial plan then you could make a failover route that takes the call information and can post it to a web page for recording and notification. Lookup how to do the webget.

We use webget to add caller-id name to a call. it takes the callers number and posts it to a website that returns the name. You can just as easily use that type of function to post your caller's number to a website that then emails that number to you letting you know that a busy occured.
james
Posts: 501
Joined: Mon Dec 10, 2007 12:56 pm

Post by james »

Hi

> We had a similar needed to email alert when a deivice failed registration


Try this.

In the [DialPlan] page
----------------------------------
[Matching Patterns]
$request = ^OPTIONS
$if($registered(To),"200","404") = (.+)

[Deploy Patterns]
$response = %1
----------------------------------
If the To-URI's SIP user is registered, it returns the response "200". Otherwise, it returns the response "404".


In the [Redundancy]->[Heartbeat] page
Heartbeat
----------------------------------
Monitoring Method: SIP
SIP URI: sip:user@localhost <--- replace user with the actual username which you want to monitor.
Interval: 30000 <---- 30 seconds
Response Codes: 404 <---- It is the trigger for sending the email.
----------------------------------

Action 1
----------------------------------
Type: Send Email
and setup it with your mail account
----------------------------------
dstu
Posts: 72
Joined: Mon Feb 06, 2006 3:56 am

Post by dstu »

But in this case, we (the brekeke) is sending the invites to a remote server and i want a failover to happen automatically if the primary destination returns busy, that in our specific case, can only happen if there a crash on the remote server or if it's full, so I'll use this procedure:
If sip:100@192.168.0.100 responds with error code 486 (Busy), the SIP Server sends the INVITE to sip:101@192.168.0.101.
-------------------------------------------------------------------------
[Deploy Patterns]
To = sip:100@192.168.0.100
$session = failover sip:101@192.168.0.101
&failover.pattern.response = 486
I don't want an email for every busy in the system, but only those related to that specific action in this specific rule.

Is that at all possible?

Thanks
voipwell.com
Posts: 528
Joined: Tue Sep 20, 2005 9:10 am
Location: Tannersville, Pennsylvania

Post by voipwell.com »

Yes, you can elect to failover only if you are sending to a particular address.
voipwell.com
Posts: 528
Joined: Tue Sep 20, 2005 9:10 am
Location: Tannersville, Pennsylvania

Post by voipwell.com »

I see your point.

How do we send an email from a dialplan that is getting executed for busy calls to 192.168.0.100 without sending an email for all calls. We only want email for busy calls to 192.168.0.100. The quandry is both successful calls and busy calls would be handled by the same dial plan so how can you fire the webget for only the failed calls?

Before we tackle that i want to make sure you understand my reference to webget and it's purpose. You would have to develop a web page that you could post values to that would cause it to send you emails. If you have the capability to do that then a webget function in the dial plan can do this for you.

James suggestion with the heartbeat suggests that you set up a heartbeat to send invites to number@192.168.0.100 and if there is no response or a busy response that it fire off an email. That can assure you that the server at 192.168.0.100 is operational and if you use a valid number that would cause that server at 192.168.0.100 to connect to another server you could go another level deep into knowing if the server is functioning or not.

Are you concerned if 192.168.0.100 is functioning and properly responding to invite packets then heartbeat is best.

Are you concerned that some of the destinations that 192.168.0.100 is sending calls to may be returning busy and you need to know that?
Where some calls may be going thru and others not and you want to know what is not going thru? Then you need to do it thru webget or a plugin. I hope that helps.
dstu
Posts: 72
Joined: Mon Feb 06, 2006 3:56 am

Post by dstu »

voipwell.com wrote:I see your point.

How do we send an email from a dialplan that is getting executed for busy calls to 192.168.0.100 without sending an email for all calls. We only want email for busy calls to 192.168.0.100. The quandry is both successful calls and busy calls would be handled by the same dial plan so how can you fire the webget for only the failed calls?

Before we tackle that i want to make sure you understand my reference to webget and it's purpose. You would have to develop a web page that you could post values to that would cause it to send you emails. If you have the capability to do that then a webget function in the dial plan can do this for you.

James suggestion with the heartbeat suggests that you set up a heartbeat to send invites to number@192.168.0.100 and if there is no response or a busy response that it fire off an email. That can assure you that the server at 192.168.0.100 is operational and if you use a valid number that would cause that server at 192.168.0.100 to connect to another server you could go another level deep into knowing if the server is functioning or not.

Are you concerned if 192.168.0.100 is functioning and properly responding to invite packets then heartbeat is best.

Are you concerned that some of the destinations that 192.168.0.100 is sending calls to may be returning busy and you need to know that?
Where some calls may be going thru and others not and you want to know what is not going thru? Then you need to do it thru webget or a plugin. I hope that helps.
Thank you for your detailed response.

1. Using webget is not a problem. I can easily prepare a small PHP page that would send an email, but the condition is that a failover event has occurred. I'm not sure how to implement that (that's the main issue, actually).

2. Referring to James' suggestion, put in your words, seems like another approach that I didn't consider, i.e. to initiate HEARTBEAT INVITE messages that are not related to live traffic and and see the response to determine the remote server's health. It's not a bad idea, but I still need to check if a BUSY would be returned in all cases,or only for specific apps, so I'll have to investigate that point once it happens again.

Thank you both for your assistance.

Regards.
voipwell.com
Posts: 528
Joined: Tue Sep 20, 2005 9:10 am
Location: Tannersville, Pennsylvania

Post by voipwell.com »

So we have the question presented more clearly now. Since the webget is in the matching pattern side of the dialplan, how do we make it conditional upon a 486 busy response? I don't see a way to change the webget values based on the response of the invite. But the question is clearer now so let's see what the others on the forum have to offer.
james
Posts: 501
Joined: Mon Dec 10, 2007 12:56 pm

Post by james »

ok
I have another idea. It doesn't use Heartbeat function.


Rule-1:
------------------------------
[Matching Patterns]
$request = ^INVITE
$localhost = true
To = sip:222@
$webget("http://your-web.com/sendmail.php?user%3D222") = .+

[Deploy Patterns]
To = sip:222@192.168.1.222
------------------------------
Rule-2:
------------------------------
[Matching Patterns]
$request = ^INVITE
To = sip:111@

[Deploy Patterns]
To = sip:111@192.168.1.111
$session = failover sip:222@localhost
&failover.pattern.response = 486
------------------------------
If 111@192.168.1.111 returns "486 Busy", the Rule-2 catches it and sends "INVITE sip:222@localhost" to the SIP server itself.
The Rule-1 catches new INVITE and calls the php webpage, and then forwards the call to the final destination sip:222@192.168.1.222.

In the above case, web url is http://your-web.com/sendmail.php?user=222
you can send an e-mail in your php.
Last edited by james on Mon Oct 07, 2013 11:29 am, edited 2 times in total.
voipwell.com
Posts: 528
Joined: Tue Sep 20, 2005 9:10 am
Location: Tannersville, Pennsylvania

Rule to Rule Dialplan Pass

Post by voipwell.com »

Since it's fo-otball season you could call this a dial plan rule to rule pass. I don't recall ever seeing one on this forum before. Thank you James and dstu!
dstu
Posts: 72
Joined: Mon Feb 06, 2006 3:56 am

Post by dstu »

james wrote:ok
I have another idea. It doesn't use Heartbeat function.


Rule-1:
------------------------------
[Matching Patterns]
$request = ^INVITE
$localhost = true
To = sip:222@
$webget("http://your-web.com/sendmail.php?user%3D222") = .+

[Deploy Patterns]
To = sip:222@192.168.1.222
------------------------------
Rule-2:
------------------------------
[Matching Patterns]
$request = ^INVITE
To = sip:111@

[Deploy Patterns]
To = sip:111@192.168.1.111
$session = failover sip:222@localhost
&failover.pattern.response = 486
------------------------------
If 111@192.168.1.111 returns "486 Busy", the Rule-2 catches it and sends "INVITE sip:222@localhost" to the SIP server itself.
The Rule-1 catches new INVITE and calls the php webpage, and then forwards the call to the final destination sip:222@192.168.1.222.

In the above case, web url is http://your-web.com/sendmail.php?user=222
you can send an e-mail in your php.
That looks like a great idea. I'll call this rule "Wide_Receiver" :-)

Thanks!!
Post Reply