Thursday, December 11, 2008

D-Star <-> SIP Translation





One of the interesting things about D-Star is it's ability to route calls between radios by callsign. There are two types of calls with D-Star; directed calls and non-directed calls. Non-directed are much like we are all used to. A CQ type listening mode, where you basically hear all general CQ style traffic on the channel. In the directed call mode, you can ignore all this (think of it as call sign squelch), kind of do-not disturb mode, but either way you can be summoned by anyone making a directed call to you. The radios display the callsign of who you are talking to kind of like a caller id type of thing.

When systems are linked a gateway server tracks where various callsigns are coming from so that directed calls can route out to the appropriate radio end point as you mobile from city to city, etc.

The Session Initiation Protocol (SIP), works very similar. It has become a standard for VOIP and other text and multimedia sessions. The sip username/ secret can represent the D-Star callsign or device / radio endpoint. SIP usernames are usually represented numerically, as in extension 200, but they can also be alphanumeric. A meetme/ conference call/room can act like that big CQ style reflector that we are used to with IRLP and Echolink.

SIP devices can register dynamically with an Asterisk Sever The best example is a SIP based Wifi phone where you may travel from hotspot to hotspot, but the server keeps track of how to route calls back to you. Much like how a D-Star gateway can track and route calls to you.

In either example, D-Star or SIP, under each packets SIP data, the callsign or extension information, there is then the Real-time Transport Protocol (RTP) audio stream carrying ones voice. With D-Star this is AMBE encoded, and with SIP it's typically encoded U-law/G.711.

John, K7VE has a D-Star dream of convergence with SIP, an established real- world protocol using by VOIP networks.

To accomplish such an Asterisk/SIP to D-Star/AMBE bridge/translation, the patented D-Star codec would have to be decoded with a $20 hardware solution, such as the DV dongle developed by Moe Wheatley, AE4JY. It can then be transcoded to more common g.711 a-law/u-law codec.

He points out that once a channel driver is properly created the whole power of Asterisk can be brought to play as a D-Star radio can then be used like any other digital IP phone endpoint; conference bridges, interactive voice response, call out, autopatch, voice recognition, etc. Basically instead of an IP phone as a digital endpoint, we could use a D-Star radio.

Using the AMBE-2020 chips in a PCI card or USB dongle will allow the conversion of the DSTAR Digital Voice to/from alaw or ulaw 8k digital voice and the chip decodes/encodes DTMF ... this combined with the datastream (containing callsigns) should enable making DSTAR radios extensions on a Asterisk PBX (or even assign a DID to them) -- total 2-way ROIP/VOIP integration that can route to/through the PSTN. (Example: dial 1-800-4KB9MWR and get a call you can pick up on your DSTAR radio and vice-versa.) Pretty powerful for EMCOMM and personal use. All enabled by open source


http://www.mail-archive.com/dstar_digital@yahoogroups.com/msg02975.html

-Update May 1st, 2009-
Scott, KI4LKF announced today that he has written an asterisk channel driver (chan dstar) that can connect to D-STAR repeaters and reflectors.

Keep your eyes peeled as this is further developed. http://asteriskradio.net/wp/2009/04/29/digital-integration-to-pstn/

And here are some thoughts on using a SIP phone/client on an Iphone or Android phone to connect to D-Star.

Here is a bit more of John's thinking. A cut and paste from an inquiry to the rtpDir yahoo group:

Subject: Re: Question on Dstar-Asterisk Integration
Date: Thursday, July 23, 2009 3:56 PM



--- In rtpDir@yahoogroups.com, "Tom Power" wrote:

Question for the Group:

Does Scott, KI4LKF's Dstar to Asterisk integration allow the passing of the Dstar integrated callsign in the Dstar Stream to Inbound Caller ID on Asterisk/SIP?

Wondering the level of integration with Asterisk.

Thinking of doing some experimenting....
Was thinking on a PBX integration point. Basically two ID-1's with one of the ID-1's having an asterisk server on one end and using it as a Autopatch, announcement system, SMS Gateway etc.

Thanks,
Tom

As Scott said, that is not what his code does, but it is something several folks have a strong interest in seeing implemented.

Now that open source (Scott's and G4ULF) gateway implementations are coming about, the integration should be a lot more approachable.

Here is what I would like to see.

A driver on Asterisk that has the following functionality:

* It creates a channel to D-STAR where an extension or DID could be mapped to a D-STAR callsign. This channel would do a few things:

Route the stream through an AMBE device (such as the DV Dongle) and bi-directionally transcode between the source CODEC (GSM, G.711, etc.) and AMBE.

It would initiate a "ring" to the D-STAR network through a gateway, setting the UR field to the destination callsign and the MY field to a callsign assigned to the PBX (e.g. KX1XXX T - T for telephony interconnect). The "caller ID" would be placed in the Icom defined 20 character short message field, so that it would show up on the display of D-STAR radios on the radio side of things. It could also send an "audio" indicator of a ring in the stream.

When the radio receives the "ring", the radio user sends back a DTMF command such as "*" to answer, "#" to hangup, "1" send to voicemail, "2" send to my landline, etc.

If no command is received within a certain amount of time, the call is sent to Voicemail.

The conversation takes place (with predefined timout).

If there is also text from the same session (e.g. Jabber/SIP) it is put into the data stream on D-STAR, so it will be available on the data port on the radio. (Bi-Directional)

At the end of the conversation, the radio user sends a DTMF hangup command (e.g. "#") - since this is connectionless, if the "telephone" user hangs up, the DTMF is unnecessary.

Conversely the radio user, sets up a call by setting up his radio:

UR: KX1XXX T
RPT1: KX1XXX A (the repeater)
RPT2: KX1XXX G (the gateway -- I think this should be removed in the future, but its how it works now)
MY: K7VE

The radio user sends a DTMF sequence to start the patch, such as "*123", then dial the number/extension you want to call and proceed like a "regular" telephone call. Then hangup using a DTMF command.

BTW, all of this should work through the D-STAR network. So you could actually go to a remote "registered" Telephony Interconnect. E.g:

UR: KX1XXX T (Boston Interconnect)
MY: K7VE (I'm in Seattle)
RPT1: K7LWH C (2 meter Bellevue WA Repeater)
RPT2: K7LWH G (Bellevue WA Gateway)

Pretty cool?

Once this is all working it is simple to use the Asterisk PBX for voicemail, interactive voice response, etc.

I am gathering the components to build a "desktop repeater" for testing, at which point I hope to work on this.

-- John, K7VE


http://www.mail-archive.com/dstar_digital@yahoogroups.com/msg02975.html

{Edit 1/2011}
Karl, N2VQM posts some good thoughts on the whole matter:
http://groups.yahoo.com/group/gmsk_dv_node/message/6210

1 comment:

kb9mwr said...

Some recommended reading:

Asterisk: The Future of Telephony, Second Edition
By Jim Van Meggelen, Jared Smith, Leif Madsen

SIP: Understanding the Session Initiation Protocol, Second Edition
By Alan B. Johnston

D-Star Technical Details
http://www.arrl.org/FandES/field/regulations/techchar/D-STAR.pdf