snom:led-remote-control

Snom LED Remote Control

Snom phones provide a set of programmable buttons, for example Snome 360 and 370 have 12 such buttons. You can extend by buying an extension panel.

Also, Snom provides a simple protocol to control this buttons from a remote site. See more about LED remote control on Snom site at:

Starting with v1.5.0, controlling the buttons with Kamailio only is trivial, by using uac module and uac_req_send().

This tutorial shows simple config to turn on/off the LEDs on your phone, showing available light modes by dialing special extensions (no answer, just busy tone back with LED light updates).

Dialing number:

  • 431 - turn the led on
  • 432 - turn the led off
  • 433 - turn the led on - light hold
  • 434 - turn the led on - light park
  • 435 - turn the led on - light pickup
  • 436 - turn the led on - light message
  • 437 - turn the led on - light offline
  • 438 - turn the led on - light sized
  • 439 - turn the led on - light record
  • 440 - turn the led on - light error

When the function key is pressed, the Snom phone will call '432' (turn LED light off).

Snom Phone Setup

The only thing you have to do is to set the function key as button. With a web browser go to your phone, access “Functions Key” in menu, and set your preferred key as button.

In this example, I used a phone with username (extension) 101, registered to Kamailio running on 192.168.178.23. The key is P2 - here is a screenshot from Snom phone config page:

Kamailio Config

The config snippets in this section are for Kamailio v3.0.x. A tutorial about how to install v3.0.x from GIT repository is available at:

First, load uac module and set append_fromtag for rr module:

loadmodule "uac.so"
...
modparam("rr", "append_fromtag", 1)

Then, define a route block, named SNOMLRCINV, that handles the extensions for LED remote control.

# Snom LRC for INVITE
route[SNOMLRCINV] {
	if(!is_method("INVITE"))
		return;
	if (!($ua =~ "snom"))
		return;
 
	if(!($rU =~ "^4"))
		return;
 
	switch($rU) {
		case "431":
			$var(light) = "on";
		break;
		case "432":
			$var(light) = "off";
		break;
		case "433":
			$var(light) = "hold";
		break;
		case "434":
			$var(light) = "park";
		break;
		case "435":
			$var(light) = "pickup";
		break;
		case "436":
			$var(light) = "message";
		break;
		case "437":
			$var(light) = "offline";
		break;
		case "438":
			$var(light) = "seized";
		break;
		case "439":
			$var(light) = "record";
		break;
		case "440":
			$var(light) = "error";
		break;
		default:
			return;
	}
 
	sl_send_reply("404", "Not a call");
 
	$uac_req(method) = "MESSAGE";
	$uac_req(ruri) = $sel(contact.uri);
	$uac_req(furi) = "sip:server@" + $Ri;
	$uac_req(turi) = $tu;
	$uac_req(ouri) = "sip:" + $si + ":" + $sp;
	$uac_req(hdrs) = "Content-Type: application/x-buttons\r\n";
	$uac_req(body) = "k=2\r\nc=" + $var(light)
			+ "\r\nn=432\r\na=invite\r\nl=Ligth is " + $var(light);
 
	uac_req_send();
	exit;
}

Just copy and paste it in your kamailio.cfg, for example at the end of the file. If you use a different function key than 2, then update k=X in $uac_req(body).

Then call this route before doing lookup(“location”) in main route block, like:

	# add next line in your config
	route(SNOMLRCINV);
 
	if (!lookup("location")) {
	...

Testing

Dial numbers from 431 to 440 to see the type of LED light. Press the function key to turn LED light off.

kb.asipto.com_images_snom-370.jpg

Use cases

This example is not really useful in real world, its goal being to show how to send SIP messages from Kamailio to Snom in order to control the function keys. But there are many nice services you can provide to your customers using Snom phones:

  • when the phone registers, check user balance and if it is too low, light one of its LEDs so he/she can top up
  • if the phone was unreachable (offline) and had missed calls without voice message, set the function key to call the caller of last missed call
  • light a LED when a certain extension is called
  • light a LED when a certain user is calling
  • set shortcuts to special numbers from server (e.g., front desk at hotel, emergency service, info service, etc) - one key dialing
  • allow users to set their function keys via web interface (or similar) and let the Kamailio SIP server configure automatically the phones when they register

See Also


100%


Copyright 2010-2020 Asipto.com