Asterisk phone grandstream budgetone

VoIP Hardware Solutions
Provider Solution Details
VoIP Hardware Zycoo UC Solutions
  • Modular Design IP PBX for SMB
  • Remote office Centralized Management solution
  • 3rd party app integration, Enterprise Billing, Android & iOS client
Details
Yeastar Communications Solutions
  • Cost-effective IP-PBX Solution for SMB
  • FXS, FXO, GSM, BRI and PRI VoIP Gateways
  • Rich features and reliable performance
Details

Tips for Grandstream Budgetone and Asterisk


  • Use dtmfmode=rfc2833 in your sip.conf for your Grandstream BudgeTone and configure the GS to use "info" DTMF signalling. This provides a workaround to hangups due to problems in the GS (see Asterisk BUG 0000742).
  • Make sure to have a username=xxx entry in sip.conf that matches the phone's name as given in the square brackets
  • make sure your phone's username = (your phone's extension) so it sends and displays the correct callerid. Otherwise, if you use a non numerical username, at least the 101 models screw up callerid display badly.
  • For most installations, this is needed in the sip.conf user definition (not in [general]):
disallow=all
allow=ulaw
allow=alaw
allow=ilbc ; requires a Grandstream firmware with iLBC support
  • If you are having problems with the phone losing registration periodically, make sure that "SUBSCRIBE for MWI" is set to "No" in the phone's configuration. This applies to at least version 1.0.4.55, possibly others.

Typical error if you fail to do apply the above codec settings:

   WARNING[22544]: File rtp.c, Line 375 (ast_rtp_read): RTP Read error:
   Resource temporarily unavailable


Make sure you remember to enable G.711 codecs in the phones configuration. On the Grandstream, ulaw and alaw is named pcmu and pcma.

Early dial

Currently (Firmware 1.0.4.55 and 1.0.4.63), early dial does not work. Early Dial means that the BudgetTone sends for each pressed digit a SIP INVITE message to Asterisk. Asterisk looks into its extensions and, if no match happened yet, it sends back a "484 Address Incomplete" message. Otherwise, it executes the action.

The bad thing now is that the BudgetTone receives the 484 and sends an SIP ACK message for it --- just not to the SIP UDP port (5060), but to UDP port 0. So the ACK never lands at Asterisk and Asterisk retransmits the 484 status message up to 5 times and finally gives up with the message

  WARNING[4101]: chan_sip.c:601 retrans_pkt: Maximum retries exceeded on call
  1c4b33fae3ec4116@192.168.233.67 for seqno 22209 (Critical Response)


Here is a partial tethereal output:

 Frame 2 (453 bytes on wire, 453 bytes captured)
 Ethernet II, Src: 00:0c:6e:01:db:01, Dst: 00:0b:82:00:a8:f1
 Internet Protocol, Src Addr: 192.168.233.66, Dst Addr: 192.168.233.67
 User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5060 (5060)
 Session Initiation Protocol
    Status-Line: SIP/2.0 484 Address Incomplete
        Status-Code: 484
    Message Header
        Via: SIP/2.0/UDP 192.168.233.67;branch=z9hG4bK0000000000000000
        From: "Holger Schurig" <sip:grandstream1@192.168.233.66>;tag=0000000000000000
            SIP from address: "Holger Schurig" <sip:grandstream1@192.168.233.66>
            SIP tag: 0000000000000000
        To: <sip:2@192.168.233.66>;tag=as32424689
            SIP to address: <sip:2@192.168.233.66>
            SIP tag: as32424689
        Call-ID: 0000000000000000@192.168.233.67
        CSeq: 46598 INVITE
        User-Agent: Asterisk PBX
        Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
        Contact: <sip:2@192.168.233.66:0>
        Content-Length: 0

 Frame 3 (512 bytes on wire, 512 bytes captured)
 Ethernet II, Src: 00:0b:82:00:a8:f1, Dst: 00:0c:6e:01:db:01
 Internet Protocol, Src Addr: 192.168.233.67, Dst Addr: 192.168.233.66
 User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 0 (0)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR!
 Session Initiation Protocol
    Request-Line: ACK sip:2@192.168.233.66:0 SIP/2.0
        Method: ACK
    Message Header
        Via: SIP/2.0/UDP 192.168.233.67;branch=z9hG4bK0000000000000000
        From: "Holger Schurig" <sip:grandstream1@192.168.233.66>;tag=0000000000000000
            SIP from address: "Holger Schurig" <sip:grandstream1@192.168.233.66>
            SIP tag: 0000000000000000
        To: <sip:2@192.168.233.66>;tag=as32424689
            SIP to address: <sip:2@192.168.233.66>
            SIP tag: as32424689
        Contact: <sip:grandstream1@192.168.233.67>
        Call-ID: 0000000000000000@192.168.233.67
        CSeq: 46598 ACK
        User-Agent: Grandstream BT100 1.0.4.63
        Max-Forwards: 70
        Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
        Content-Length: 0

You can work around this problem by redirecting traffic from port 0 to port 5060 on your Linux box, e.g. with

  1. iptables -t nat -A PREROUTING -p udp -i eth0 --dport 0 -j REDIRECT --to-port 5060

Additionally, early dial and challenge/MD5 authentication do not work, as of firmware 1.0.5.0. Specifically, the Grandstream device correctly handles the "407 Authentication Required" challenge for the first two digits, but (usually) once the third is reached, it decides that 407 is a failure code, produces a busy signal, and aborts the call. This can be worked around by specifying "auth=plaintext" in your [sip.conf].
Below is terse tethereal output, showing the problem:

Phone -> Asterisk SIP/SDP Request: INVITE sip:9@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 407 Proxy Authentication Required
Phone -> Asterisk SIP Request: ACK sip:9@Asterisk
Phone -> Asterisk SIP/SDP Request: INVITE sip:9@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 484 Address Incomplete
Phone -> Asterisk SIP Request: ACK sip:9@Asterisk
Phone -> Asterisk SIP/SDP Request: INVITE sip:91@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 407 Proxy Authentication Required
Phone -> Asterisk SIP Request: ACK sip:91@Asterisk
Phone -> Asterisk SIP/SDP Request: INVITE sip:91@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 484 Address Incomplete
Phone -> Asterisk SIP Request: ACK sip:91@Asterisk
Phone -> Asterisk SIP/SDP Request: INVITE sip:918@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 407 Proxy Authentication Required
Phone -> Asterisk SIP Request: ACK sip:918@Asterisk
<phone emits busy signal>

Call waiting

Reportedly working for firmware 3.81 and later: Pressing FLASH once puts the 1st call on hold and answers the 2nd call. Pressing FLASH again puts second caller on hold and returns to first caller, etc. For this to work you must check your "send flash as DTMF event" option in the phone's setup: for call waiting you must have this option set to No (false).

For old firmware versions only where call waiting cannot be turned off in the phone's Web interface: Use incominglimlit=1 in sip.conf if you want to switch off call waiting and to prevent the phone ringing loudly in the middle of your conversation when a 2nd call comes in ("call waiting signal"). This setting requires a username= statement.

DND and call forwarding

Introduced with firmware 1.0.4.73 (and later)
  • Do not disturb = *70
  • Unconditional Call Forward = *72
  • --Cancel UCF = *73
  • Busy Call Forward = *90
  • --Cancel BCF = *91
  • Delayed Call Forward = *92
  • --Cancel DCF = *93

GS behind NAT, Asterisk on public IP address

Note: This is one way of doing things, but probably not the only way.

Check out the Asterisk SIP NAT solutions page

  • set the GS to "SIP server=asterisk.yourhost.com" and leave "Outbound Proxy" empty
  • set the GS to SIP port 5062 and RTP port 5004 (and "Use random port=No")
  • set the GS to "NAT traversal=Yes" with "STUN server=stun.xten.net"
  • arrange port forwarding on your NAT router for tcp/udp 5062 and udp 5004 to your GS phone's IP address
  • enter "nat=yes" and "canreinvite=no" in your sip.conf for this GS phone user
  • in this order: issue a "reload" in the Asterisk console, restart your NAT router and reboot the phone

Choppy sound?

Some (older?) GS phones have a setting for "Voice Frames per TX" with a default value of 10. This causes the phone to use a 100ms packet size and Asterisk is set to use a 20ms packet size. The result is choppy sound when calling out over the PSTN (specifically in my case over an X100P).

The solution is to set this value to 2 which will clear up the choppy sound.

Regular reboot

I have used curl to reboot the GS101 as follows (to prevent the phone losing registration):

curl -c cookies.txt -d"P2=xxxxx&Login=Login&gnkey=0b82" http://192.168.1.xxx/dologin.htm
curl -b cookies.txt http://192.168.1.xxx/rs.htm

Put these 2 lines in a script and use cron to reboot every day.

Problems with AGI

Taken from bug 695:
Affected Grandstream firmware: unclear (reported at leat for 1.0.4.17):

I think I know what's going on here. The error is caused by the print "SEND TEXT \"hello world\"\n"; in agi-test.agi. It causes a SIP "MESSAGE" packet to be sent and returns assuming all is OK if the packet is scheduled for transmission.

The Grandstream phones do not support MESSAGE and basically ignore it. This causes Asterisk to retransmit the packet. When Asterisk runs out of retries some time later, it hangs up the channel and subsequent AGI commands fail. This usually happens for me towards the end of the test as Asterisk is reading out a number.

If you try the AGI with an ATA186 it will run through OK. This is because the ATA will return a "Not implemented" response to a MESSAGE, causing Asterisk to stop sending the message.

So, ideally Asterisk shouldn't hang up the channel because it leaves the AGI unaware of the channel state. Equally, Grandstream needs to update its firmware to provide the "Not implemented" response.

TFTP server

The GS phones use TFTP extensions (RFC 2347) to provide additional information in their TFTP requests. The server has to be aware of these extensions, if it wants to serve different files.

Official Grandstream TFTP server

Set the tftp server IP address to 4.3.153.50 (works only for phones, not other TFTP clients)

DigitNetworks Support


Telappliant support


GratisSip public tftp

  • firmware, TFTP server and instructions. Also supports selecting which firmware version you want to use and allows for uploads/comments on existing firmwares. http://gs-firmware.gratissip.dk/

How the GS uses TFTP

Here is a small dump for a request from an HandyTone (key/value) :

grandstream_MODEL HT-100
grandstream_NAT 1
grandstream_ID 000b8200c14a
grandstream_REV_BOOT 001000000013
grandstream_REV_PHONE 001000004026
grandstream_REV_VOC 001000000002
grandstream_REV_HTML 001000000020
grandstream_REV_VP 001000000000

We can easily see the MAC address, the model and the current firmware versions (1.4.26).

With these informations, the TFTP server could :
  • serve the right cfg.txt file
  • serve the right firmware files (or actually, serving nothing if the server considers the phone to be up to date).

Configuration

Stephen R. Besch created a general purpose configuration utility for the GS phones to
  • Generates files from scratch (using MAC), from HTML config listing, or by directly downloading from the phone.
  • Does multiple simulteneous edits.
  • Can reboot as many or as few phones at a time as you like.
The zipped install package can be downloaded from http://linuxbio.med.buffalo.edu/php/GSConfigure.php

Sample config files

Read more about APS:
Please note that Plug'n'Dial APS is not compatible with GS phones or adapters.

This document describes the Plug'n'Dial Auto Provisioning System, a lightweight open standard designed to allow SIP device manufacturers to quickly and easily integrate their devices with the SIPphone.com calling network and directory service.

A Plug'n'Dial compatible device is one that is capable of retrieving it's SIP configuration from the APS server at boot time. The device must be capable of communicating across a network via the TFTP protocol and should have the ability to execute a MD5 checksum verification process.

The APS Configuration File

A Plug'n'Dial compatible device decides at boot time via a checksum verification process whether to load a new SIP configuration file. If the device determines that it needs to acquire a new configuration file, it requests a file from the APS server using the following file naming convention:

<mac_address>.txt

The directory structure of the APS server is "2 deep". To determine the directory location of a given device's SIP configuration file, use the first four digits of the MAC address as the parent directory and the second four digits of the MAC address as the subdirectory. For example, the path of the SIP configuration file for a device identified by MAC address 000b820c2371 is as follows:

/000b/820c/000b820c2371.txt

# SIP Configuration File, Plug'n'Dial APS v1.1
mac=000b820c2371 
sipserver=proxy01.sipphone.com 
sipserver_port=5060 
outboundproxy=null 
outboundproxy_port=null 
userid=8003 
authenticateid=8003 
codec1=PCMU 
codec2=PCMA 
codec3=G723 
codec4=G729 
codec5=null 
codec6=null 
silence_supporession=no 
voice_frames_per_tx=2 
ipqos=48 
vlantag=0 
registration_expiration=10 
local_sip_port=5060 
local_rtp_port=5004 
use_random_rtp_port=no 
stun=stun01.sipphone.com 
stun_port=3478 
tftp_server=192.168.x.x
tftp_server_port=69 
send_dtmf=in-audio 
dtmf_payload_type=101 
ntp_server=ntp01.sipphone.com 
time_zone=GMT-0 

Note that null values in the SIP configuration file should not be taken literally. A null value means "do not overwrite this value" as opposed to "set this value to null".

Provisioning Method

At boot time the device should request the MD5 checksum for the SIP configuration file from the APS server. The checksum is stored in a file with the same path and filename as the SIP configuration file, with the exception that the checksum file has ".MD5" extension. For example, the path of the file that contains the checksum for file 000b820c2371.txt is as follows:

/000b/820c/000b820c2371.MD5

If the device determines that the checksum differs from that of the currently loaded SIP configuration file, the device should request the SIP configuration file from APS server. After downloading the SIP configuration file the device should load the settings from the file and perform a soft reboot.

Custom ringtones

It is a fact that there are two hardware revisions of the phone, which they call "Rev A" and "Rev B." Only "Rev B" phones are able to use ringtones, so those who have the older model are wasting their time trying to use them.
Apparently an upcoming firmware release will reveal which version is on a given phone. In general, I was told, the matte-finish ones are Rev B, and the shiny ones are Rev A.

Note that the phones don't support ALERT_INFO, so you can only select ringtones based on the caller ID reaching the phone, and not set it from within Asterisk

Pattern matching on CallerId

You can instruct your phone to use a different ring sound based upon the incoming caller id: If, for example, you select the built-in standard ringtone as your default ringtone in the web interface, and enter "30" for the 1st custom ring tone and "4" for the 2nd custom ring tone then a partial leading match of the callerid will trigger the respecitve sound.
Example: 302 --> 1st custom sound, 485 --> 2nd custom sound.
Please note that under IP-to-IP mode (?i.e. calling directly phone-to-phone without Asterisk or another call manager?), you need to first enter the IP calling mode and then press *72 (or *90 or *92) to activate the call forwarding.

Firmware 1.0.4.68

I decided to write a perl program to read a uLaw stream on standard input and create a suitable header, writing the result to an output file.

It can be found at http://www.softins.co.uk/makering.pl.txt. Save and rename to makering.pl. Usage is described in the file, but here is an example:
sox inputfile -r 8000 -c 1 -t ul - rate | makering.pl ring1.bin
(try using /usr/share/sounds/phone.wav for the inputfile). After putting the ringN.bin file into /tftpboot and rebooting my phone, amazingly enough it works! I now have a new ringtone.

Firmware 1.0.5.0

  • When creating the audio file make sure that it is called ring.bin. Later on rename this to ring1.bin or ring2.bin or ring3.bin when preparing the TFTP upload.
  • Updated makering.pl script

Individual ring tones for each phone

I have just successfully got the TFTP file remapping to work such that I can have unique ringtone files for each and every extension. I added the following to my server_args line in the xinetd configuration for TFTP:

-m /home/asterisk/grandstream/ringmap.cfg

Now the entire line reads:

server_args = -v -s /home/asterisk/grandstream -u asterisk -m /home/asterisk/grandstream/ringmap.cfg

(There is no line break in the actual file!). When debugging, you can use more "v"'s in the verbosity option. Then, in the TFTP root, I add the file "ringmap.cfg", with access rights set to 660 (so that the TFTP server won't serve the file up). That file contains the following line:

ri ring(.)\.bin ring\1_\i

This tells TFTP to replace any file requests that look like "ringx.bin" with ringx_yyy.yyy.yyy.yyy, where yyy.yyy.yyy.yyy is the phone's IP address. So, for example, if 192.168.10.100 requests ring1.bin, TFTP will get ring1_192.168.10.100 and serve it up as ring1.bin, effectively lying to the phone. Then you only have to generate your ring files and place them in the TFTP root folder with access rights 664. Works like a charm!
--Stephen R. Besch



Hardware

Looks like they epoxied over three of the chips. One is a 73pin, another is a 44 pin, and the last looks to be a 44 pin.

Ethernet is a RTL8019AS (10mbit) and it's using a Tamarack TC3097-8 repeater (HUB) which actually supports 9 ports (8 ethernet, 1 AUI). Obviously this is only a 10mbit repeater. It's worth noting that this chip is end of life. Figure a couple bucks for these if you can get them, sounds like old stock to me.

Flash memory looks to be about 8m according to the 29LV800ABTC-70 flash ram chip. These are going for under $1, sounds like more old stock.

The Xilinx XC9536XL CPLD is a low-end logic "glue" chip ... It's around $2

Anyway, I'm not a hardware guy but that's what I see.

The Message Button and Message Waiting

The Message button does not have a flashing LED underneath it. Message Waiting is indicated by the backlight of the LCD Display flashing. In order to make use of the Message button, log into the phone's Web configurator and add the appropiate extension (eg 123) to dial in the Voice Mail UserID: field. Also add the same extension number into your extensions.conf file - something like..
exten => 123,1,VoicemailMain(s${CALLERIDNUM})

The Message Button and Message Waiting and Asterisk @ Home

Asterisk @ Home doesn't do voicemail extensions separately, so you need to put your own extension number in the web interface to make MWI work.
This means when you press the messages button you get your own extension which is now busy :-)
A workaround is changing your [macro-exten-vm] in extensions.conf like this:
  • 1 - Add this and renumber to fit it in: exten => s,4,GotoIf($[${ARG1} = ${CALLERIDNUM}]?s-MSG,1)
  • 2 - Add this: exten => s-MSG,1,VoicemailMain(s${CALLERIDNUM})

Which means when you press the messages button (or call your own extension) you go straight to voicemail.

Using the Called and Callers buttons

These phones store the last 20 numbers you called and the last 20 people who called you - if you get (can display) their Caller-ID

people you have called

  • 1 - Pick up phone (or push speakerphone)
  • 2 - Push called repeatedly until you get to the number you want
  • 3 - Push send

People who called you

Exactly the same as above - except use the callers button. Here is where you learn that its a good idea to modify the Caller-ID you receive (along with a sane dialling plan) so that it can be redialed without change. That you do in Asterisk.

Someone at Grandstream decided you'd pick up the phone and get a dialtone before pushing Called/Callers. I would have prefered to select the number first then push send. Then again, I'd like to be able to dial a number on the keypad - then push send or speakerphone - like my CellPhone and many DECT phones.

No sound when called with firmaware 1.0.6.3 ?

IT seems there's an error with fixed RTP port in firmawre 1.0.6.3.
In my case, I don't have any sound when called after upgrading.
This problem can be solved by setting "Use random port:" to yes.

See also:



Asterisk | Asterisk Configuration | Channel Configuration | Configuration for Specific Phones

Tips for Grandstream Budgetone and Asterisk


  • Use dtmfmode=rfc2833 in your sip.conf for your Grandstream BudgeTone and configure the GS to use "info" DTMF signalling. This provides a workaround to hangups due to problems in the GS (see Asterisk BUG 0000742).
  • Make sure to have a username=xxx entry in sip.conf that matches the phone's name as given in the square brackets
  • make sure your phone's username = (your phone's extension) so it sends and displays the correct callerid. Otherwise, if you use a non numerical username, at least the 101 models screw up callerid display badly.
  • For most installations, this is needed in the sip.conf user definition (not in [general]):
disallow=all
allow=ulaw
allow=alaw
allow=ilbc ; requires a Grandstream firmware with iLBC support
  • If you are having problems with the phone losing registration periodically, make sure that "SUBSCRIBE for MWI" is set to "No" in the phone's configuration. This applies to at least version 1.0.4.55, possibly others.

Typical error if you fail to do apply the above codec settings:

   WARNING[22544]: File rtp.c, Line 375 (ast_rtp_read): RTP Read error:
   Resource temporarily unavailable


Make sure you remember to enable G.711 codecs in the phones configuration. On the Grandstream, ulaw and alaw is named pcmu and pcma.

Early dial

Currently (Firmware 1.0.4.55 and 1.0.4.63), early dial does not work. Early Dial means that the BudgetTone sends for each pressed digit a SIP INVITE message to Asterisk. Asterisk looks into its extensions and, if no match happened yet, it sends back a "484 Address Incomplete" message. Otherwise, it executes the action.

The bad thing now is that the BudgetTone receives the 484 and sends an SIP ACK message for it --- just not to the SIP UDP port (5060), but to UDP port 0. So the ACK never lands at Asterisk and Asterisk retransmits the 484 status message up to 5 times and finally gives up with the message

  WARNING[4101]: chan_sip.c:601 retrans_pkt: Maximum retries exceeded on call
  1c4b33fae3ec4116@192.168.233.67 for seqno 22209 (Critical Response)


Here is a partial tethereal output:

 Frame 2 (453 bytes on wire, 453 bytes captured)
 Ethernet II, Src: 00:0c:6e:01:db:01, Dst: 00:0b:82:00:a8:f1
 Internet Protocol, Src Addr: 192.168.233.66, Dst Addr: 192.168.233.67
 User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5060 (5060)
 Session Initiation Protocol
    Status-Line: SIP/2.0 484 Address Incomplete
        Status-Code: 484
    Message Header
        Via: SIP/2.0/UDP 192.168.233.67;branch=z9hG4bK0000000000000000
        From: "Holger Schurig" <sip:grandstream1@192.168.233.66>;tag=0000000000000000
            SIP from address: "Holger Schurig" <sip:grandstream1@192.168.233.66>
            SIP tag: 0000000000000000
        To: <sip:2@192.168.233.66>;tag=as32424689
            SIP to address: <sip:2@192.168.233.66>
            SIP tag: as32424689
        Call-ID: 0000000000000000@192.168.233.67
        CSeq: 46598 INVITE
        User-Agent: Asterisk PBX
        Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
        Contact: <sip:2@192.168.233.66:0>
        Content-Length: 0

 Frame 3 (512 bytes on wire, 512 bytes captured)
 Ethernet II, Src: 00:0b:82:00:a8:f1, Dst: 00:0c:6e:01:db:01
 Internet Protocol, Src Addr: 192.168.233.67, Dst Addr: 192.168.233.66
 User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 0 (0)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ERROR!
 Session Initiation Protocol
    Request-Line: ACK sip:2@192.168.233.66:0 SIP/2.0
        Method: ACK
    Message Header
        Via: SIP/2.0/UDP 192.168.233.67;branch=z9hG4bK0000000000000000
        From: "Holger Schurig" <sip:grandstream1@192.168.233.66>;tag=0000000000000000
            SIP from address: "Holger Schurig" <sip:grandstream1@192.168.233.66>
            SIP tag: 0000000000000000
        To: <sip:2@192.168.233.66>;tag=as32424689
            SIP to address: <sip:2@192.168.233.66>
            SIP tag: as32424689
        Contact: <sip:grandstream1@192.168.233.67>
        Call-ID: 0000000000000000@192.168.233.67
        CSeq: 46598 ACK
        User-Agent: Grandstream BT100 1.0.4.63
        Max-Forwards: 70
        Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
        Content-Length: 0

You can work around this problem by redirecting traffic from port 0 to port 5060 on your Linux box, e.g. with

  1. iptables -t nat -A PREROUTING -p udp -i eth0 --dport 0 -j REDIRECT --to-port 5060

Additionally, early dial and challenge/MD5 authentication do not work, as of firmware 1.0.5.0. Specifically, the Grandstream device correctly handles the "407 Authentication Required" challenge for the first two digits, but (usually) once the third is reached, it decides that 407 is a failure code, produces a busy signal, and aborts the call. This can be worked around by specifying "auth=plaintext" in your [sip.conf].
Below is terse tethereal output, showing the problem:

Phone -> Asterisk SIP/SDP Request: INVITE sip:9@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 407 Proxy Authentication Required
Phone -> Asterisk SIP Request: ACK sip:9@Asterisk
Phone -> Asterisk SIP/SDP Request: INVITE sip:9@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 484 Address Incomplete
Phone -> Asterisk SIP Request: ACK sip:9@Asterisk
Phone -> Asterisk SIP/SDP Request: INVITE sip:91@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 407 Proxy Authentication Required
Phone -> Asterisk SIP Request: ACK sip:91@Asterisk
Phone -> Asterisk SIP/SDP Request: INVITE sip:91@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 484 Address Incomplete
Phone -> Asterisk SIP Request: ACK sip:91@Asterisk
Phone -> Asterisk SIP/SDP Request: INVITE sip:918@Asterisk, w/session desc.
Asterisk -> Phone SIP Status: 407 Proxy Authentication Required
Phone -> Asterisk SIP Request: ACK sip:918@Asterisk
<phone emits busy signal>

Call waiting

Reportedly working for firmware 3.81 and later: Pressing FLASH once puts the 1st call on hold and answers the 2nd call. Pressing FLASH again puts second caller on hold and returns to first caller, etc. For this to work you must check your "send flash as DTMF event" option in the phone's setup: for call waiting you must have this option set to No (false).

For old firmware versions only where call waiting cannot be turned off in the phone's Web interface: Use incominglimlit=1 in sip.conf if you want to switch off call waiting and to prevent the phone ringing loudly in the middle of your conversation when a 2nd call comes in ("call waiting signal"). This setting requires a username= statement.

DND and call forwarding

Introduced with firmware 1.0.4.73 (and later)
  • Do not disturb = *70
  • Unconditional Call Forward = *72
  • --Cancel UCF = *73
  • Busy Call Forward = *90
  • --Cancel BCF = *91
  • Delayed Call Forward = *92
  • --Cancel DCF = *93

GS behind NAT, Asterisk on public IP address

Note: This is one way of doing things, but probably not the only way.

Check out the Asterisk SIP NAT solutions page

  • set the GS to "SIP server=asterisk.yourhost.com" and leave "Outbound Proxy" empty
  • set the GS to SIP port 5062 and RTP port 5004 (and "Use random port=No")
  • set the GS to "NAT traversal=Yes" with "STUN server=stun.xten.net"
  • arrange port forwarding on your NAT router for tcp/udp 5062 and udp 5004 to your GS phone's IP address
  • enter "nat=yes" and "canreinvite=no" in your sip.conf for this GS phone user
  • in this order: issue a "reload" in the Asterisk console, restart your NAT router and reboot the phone

Choppy sound?

Some (older?) GS phones have a setting for "Voice Frames per TX" with a default value of 10. This causes the phone to use a 100ms packet size and Asterisk is set to use a 20ms packet size. The result is choppy sound when calling out over the PSTN (specifically in my case over an X100P).

The solution is to set this value to 2 which will clear up the choppy sound.

Regular reboot

I have used curl to reboot the GS101 as follows (to prevent the phone losing registration):

curl -c cookies.txt -d"P2=xxxxx&Login=Login&gnkey=0b82" http://192.168.1.xxx/dologin.htm
curl -b cookies.txt http://192.168.1.xxx/rs.htm

Put these 2 lines in a script and use cron to reboot every day.

Problems with AGI

Taken from bug 695:
Affected Grandstream firmware: unclear (reported at leat for 1.0.4.17):

I think I know what's going on here. The error is caused by the print "SEND TEXT \"hello world\"\n"; in agi-test.agi. It causes a SIP "MESSAGE" packet to be sent and returns assuming all is OK if the packet is scheduled for transmission.

The Grandstream phones do not support MESSAGE and basically ignore it. This causes Asterisk to retransmit the packet. When Asterisk runs out of retries some time later, it hangs up the channel and subsequent AGI commands fail. This usually happens for me towards the end of the test as Asterisk is reading out a number.

If you try the AGI with an ATA186 it will run through OK. This is because the ATA will return a "Not implemented" response to a MESSAGE, causing Asterisk to stop sending the message.

So, ideally Asterisk shouldn't hang up the channel because it leaves the AGI unaware of the channel state. Equally, Grandstream needs to update its firmware to provide the "Not implemented" response.

TFTP server

The GS phones use TFTP extensions (RFC 2347) to provide additional information in their TFTP requests. The server has to be aware of these extensions, if it wants to serve different files.

Official Grandstream TFTP server

Set the tftp server IP address to 4.3.153.50 (works only for phones, not other TFTP clients)

DigitNetworks Support


Telappliant support


GratisSip public tftp

  • firmware, TFTP server and instructions. Also supports selecting which firmware version you want to use and allows for uploads/comments on existing firmwares. http://gs-firmware.gratissip.dk/

How the GS uses TFTP

Here is a small dump for a request from an HandyTone (key/value) :

grandstream_MODEL HT-100
grandstream_NAT 1
grandstream_ID 000b8200c14a
grandstream_REV_BOOT 001000000013
grandstream_REV_PHONE 001000004026
grandstream_REV_VOC 001000000002
grandstream_REV_HTML 001000000020
grandstream_REV_VP 001000000000

We can easily see the MAC address, the model and the current firmware versions (1.4.26).

With these informations, the TFTP server could :
  • serve the right cfg.txt file
  • serve the right firmware files (or actually, serving nothing if the server considers the phone to be up to date).

Configuration

Stephen R. Besch created a general purpose configuration utility for the GS phones to
  • Generates files from scratch (using MAC), from HTML config listing, or by directly downloading from the phone.
  • Does multiple simulteneous edits.
  • Can reboot as many or as few phones at a time as you like.
The zipped install package can be downloaded from http://linuxbio.med.buffalo.edu/php/GSConfigure.php

Sample config files

Read more about APS:
Please note that Plug'n'Dial APS is not compatible with GS phones or adapters.

This document describes the Plug'n'Dial Auto Provisioning System, a lightweight open standard designed to allow SIP device manufacturers to quickly and easily integrate their devices with the SIPphone.com calling network and directory service.

A Plug'n'Dial compatible device is one that is capable of retrieving it's SIP configuration from the APS server at boot time. The device must be capable of communicating across a network via the TFTP protocol and should have the ability to execute a MD5 checksum verification process.

The APS Configuration File

A Plug'n'Dial compatible device decides at boot time via a checksum verification process whether to load a new SIP configuration file. If the device determines that it needs to acquire a new configuration file, it requests a file from the APS server using the following file naming convention:

<mac_address>.txt

The directory structure of the APS server is "2 deep". To determine the directory location of a given device's SIP configuration file, use the first four digits of the MAC address as the parent directory and the second four digits of the MAC address as the subdirectory. For example, the path of the SIP configuration file for a device identified by MAC address 000b820c2371 is as follows:

/000b/820c/000b820c2371.txt

# SIP Configuration File, Plug'n'Dial APS v1.1
mac=000b820c2371 
sipserver=proxy01.sipphone.com 
sipserver_port=5060 
outboundproxy=null 
outboundproxy_port=null 
userid=8003 
authenticateid=8003 
codec1=PCMU 
codec2=PCMA 
codec3=G723 
codec4=G729 
codec5=null 
codec6=null 
silence_supporession=no 
voice_frames_per_tx=2 
ipqos=48 
vlantag=0 
registration_expiration=10 
local_sip_port=5060 
local_rtp_port=5004 
use_random_rtp_port=no 
stun=stun01.sipphone.com 
stun_port=3478 
tftp_server=192.168.x.x
tftp_server_port=69 
send_dtmf=in-audio 
dtmf_payload_type=101 
ntp_server=ntp01.sipphone.com 
time_zone=GMT-0 

Note that null values in the SIP configuration file should not be taken literally. A null value means "do not overwrite this value" as opposed to "set this value to null".

Provisioning Method

At boot time the device should request the MD5 checksum for the SIP configuration file from the APS server. The checksum is stored in a file with the same path and filename as the SIP configuration file, with the exception that the checksum file has ".MD5" extension. For example, the path of the file that contains the checksum for file 000b820c2371.txt is as follows:

/000b/820c/000b820c2371.MD5

If the device determines that the checksum differs from that of the currently loaded SIP configuration file, the device should request the SIP configuration file from APS server. After downloading the SIP configuration file the device should load the settings from the file and perform a soft reboot.

Custom ringtones

It is a fact that there are two hardware revisions of the phone, which they call "Rev A" and "Rev B." Only "Rev B" phones are able to use ringtones, so those who have the older model are wasting their time trying to use them.
Apparently an upcoming firmware release will reveal which version is on a given phone. In general, I was told, the matte-finish ones are Rev B, and the shiny ones are Rev A.

Note that the phones don't support ALERT_INFO, so you can only select ringtones based on the caller ID reaching the phone, and not set it from within Asterisk

Pattern matching on CallerId

You can instruct your phone to use a different ring sound based upon the incoming caller id: If, for example, you select the built-in standard ringtone as your default ringtone in the web interface, and enter "30" for the 1st custom ring tone and "4" for the 2nd custom ring tone then a partial leading match of the callerid will trigger the respecitve sound.
Example: 302 --> 1st custom sound, 485 --> 2nd custom sound.
Please note that under IP-to-IP mode (?i.e. calling directly phone-to-phone without Asterisk or another call manager?), you need to first enter the IP calling mode and then press *72 (or *90 or *92) to activate the call forwarding.

Firmware 1.0.4.68

I decided to write a perl program to read a uLaw stream on standard input and create a suitable header, writing the result to an output file.

It can be found at http://www.softins.co.uk/makering.pl.txt. Save and rename to makering.pl. Usage is described in the file, but here is an example:
sox inputfile -r 8000 -c 1 -t ul - rate | makering.pl ring1.bin
(try using /usr/share/sounds/phone.wav for the inputfile). After putting the ringN.bin file into /tftpboot and rebooting my phone, amazingly enough it works! I now have a new ringtone.

Firmware 1.0.5.0

  • When creating the audio file make sure that it is called ring.bin. Later on rename this to ring1.bin or ring2.bin or ring3.bin when preparing the TFTP upload.
  • Updated makering.pl script

Individual ring tones for each phone

I have just successfully got the TFTP file remapping to work such that I can have unique ringtone files for each and every extension. I added the following to my server_args line in the xinetd configuration for TFTP:

-m /home/asterisk/grandstream/ringmap.cfg

Now the entire line reads:

server_args = -v -s /home/asterisk/grandstream -u asterisk -m /home/asterisk/grandstream/ringmap.cfg

(There is no line break in the actual file!). When debugging, you can use more "v"'s in the verbosity option. Then, in the TFTP root, I add the file "ringmap.cfg", with access rights set to 660 (so that the TFTP server won't serve the file up). That file contains the following line:

ri ring(.)\.bin ring\1_\i

This tells TFTP to replace any file requests that look like "ringx.bin" with ringx_yyy.yyy.yyy.yyy, where yyy.yyy.yyy.yyy is the phone's IP address. So, for example, if 192.168.10.100 requests ring1.bin, TFTP will get ring1_192.168.10.100 and serve it up as ring1.bin, effectively lying to the phone. Then you only have to generate your ring files and place them in the TFTP root folder with access rights 664. Works like a charm!
--Stephen R. Besch



Hardware

Looks like they epoxied over three of the chips. One is a 73pin, another is a 44 pin, and the last looks to be a 44 pin.

Ethernet is a RTL8019AS (10mbit) and it's using a Tamarack TC3097-8 repeater (HUB) which actually supports 9 ports (8 ethernet, 1 AUI). Obviously this is only a 10mbit repeater. It's worth noting that this chip is end of life. Figure a couple bucks for these if you can get them, sounds like old stock to me.

Flash memory looks to be about 8m according to the 29LV800ABTC-70 flash ram chip. These are going for under $1, sounds like more old stock.

The Xilinx XC9536XL CPLD is a low-end logic "glue" chip ... It's around $2

Anyway, I'm not a hardware guy but that's what I see.

The Message Button and Message Waiting

The Message button does not have a flashing LED underneath it. Message Waiting is indicated by the backlight of the LCD Display flashing. In order to make use of the Message button, log into the phone's Web configurator and add the appropiate extension (eg 123) to dial in the Voice Mail UserID: field. Also add the same extension number into your extensions.conf file - something like..
exten => 123,1,VoicemailMain(s${CALLERIDNUM})

The Message Button and Message Waiting and Asterisk @ Home

Asterisk @ Home doesn't do voicemail extensions separately, so you need to put your own extension number in the web interface to make MWI work.
This means when you press the messages button you get your own extension which is now busy :-)
A workaround is changing your [macro-exten-vm] in extensions.conf like this:
  • 1 - Add this and renumber to fit it in: exten => s,4,GotoIf($[${ARG1} = ${CALLERIDNUM}]?s-MSG,1)
  • 2 - Add this: exten => s-MSG,1,VoicemailMain(s${CALLERIDNUM})

Which means when you press the messages button (or call your own extension) you go straight to voicemail.

Using the Called and Callers buttons

These phones store the last 20 numbers you called and the last 20 people who called you - if you get (can display) their Caller-ID

people you have called

  • 1 - Pick up phone (or push speakerphone)
  • 2 - Push called repeatedly until you get to the number you want
  • 3 - Push send

People who called you

Exactly the same as above - except use the callers button. Here is where you learn that its a good idea to modify the Caller-ID you receive (along with a sane dialling plan) so that it can be redialed without change. That you do in Asterisk.

Someone at Grandstream decided you'd pick up the phone and get a dialtone before pushing Called/Callers. I would have prefered to select the number first then push send. Then again, I'd like to be able to dial a number on the keypad - then push send or speakerphone - like my CellPhone and many DECT phones.

No sound when called with firmaware 1.0.6.3 ?

IT seems there's an error with fixed RTP port in firmawre 1.0.6.3.
In my case, I don't have any sound when called after upgrading.
This problem can be solved by setting "Use random port:" to yes.

See also:



Asterisk | Asterisk Configuration | Channel Configuration | Configuration for Specific Phones
Created by: oej, Last modification: Thu 10 of May, 2012 (19:11 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+