Code Studio Blog

Just another software enthusiast notes

Archive for the tag “CVHU”

Episode 2 : Answering Machine, AT commands and GSM modem interaction

Hi, in this “Episode 2″ of my sequel on create working “answering machine” I show you a subset of usefull E1750 AT command and how chain this commands to prepare the device for programmatically make/receive voice call. I must tanks “Carlos Ruiz Díaz” for its works Caruizdiaz that help me to understand the meaning of some commands.

Note about AT command: for most command you can obtain the current value or the possilbe values of parameter using the follow syntax:

<ATCOMMAND>?        => get current value

<ATCOMMAND>=?     => get possible values of parameter

<ATCOMMAND>=XXX     => set the value of parameter to XXX

Let’s go, these are the commands:

  • AT => check if device is live.
  • AT^U2DIAG  => disable some embedded device components (see here for more informations); we use this command on Episode 1 to disable USB dongle CD interface (setting it to 256 value)
  • AT^CURC => manage visualizzation of messages that modem periodicallly sends to serial interface (disable periodic message with AT^CURC = 0 : we use the serial interface to detect command response and this random message confuse our software)
  • AT^GETPORTMODE => get the list of device ports and their usage.
  • AT+CPIN => use it to enter the PIN of device an unlock it
  • AT+CVHU => manage the ATH hang-up command effect (enable hang-up voice call with ATH commnad using AT+CVHU=0)
  • ATDT => make a call, to make a voice call use this sintax: ATDT123456789; where 123456789 is the phone number; here “;” is essential, it tell to modem to do a voice call instead of data call.
  • ATH => hang-up call, to enable it to hang-up voice call you first must use AT+CVHU=0
  • AT+CRC => manage the RING message sending to serial port when an incoming voice call is received. We need the RING message, then enable it using AT+CRC=1
  • AT+CLIP => manage the additional CALLER information sending to serial port. We need the caller phone number to filter the authorized caller, then enable it using AT+CLIP =1
  • AT^CVOICE => return the information about audio format used by device for voice calls
  • AT^DDSETEX => set the destination port of voice after a voice calls is established. We use this to redirect the audio to other serial port of device (the one named “…3G Application Interface…”) and read with our software. Usa a command AT^DDSETEX=2 after call is established.

Simple call test with AT command

Now we can start a simple example and estabilish a voice call with an other device using only AT command in right sequence. You can use another GSM phone or a fixed phone as destination of your call. I show you also the meaning of dignostic message showed in serial monitor (Teraterm)

  • Connect USB dongle (with working SIM) to PC start Teraterm and enable “Local Echo”.
  • Start Teraterm session to COM port with description as “… PC UI INTERFACE …”. After some time you should see the periodic diagnostic messages of modem
AT command - diagnostic messages

AT command – diagnostic messages

  • We not need diagnostic messages, then disable it using AT^CURC = 0
  • Insert SIM PIN using AT+CPIN=<SIM pin number>
  • Enable hangup command using AT+CVHU=0
  • Enable ring and caller information reporting using AT+CRC=1 and AT+CLIP =1

and now…make a call

  • Run ATDT<your destination phone number>;
  • The destination phone RINGS and you can answer but you CAN’T send and receive voice, you need to WRITE SOME SOFTWARE TO HEAR AND SEND VOICE
  • The follow is the complete stack of Teraterm, you can see that after ATDT the monitor print:
    • ORIGIN:1,0 this means : CALL ID = 1; CALL TYPE = 0 (voice)
    • CONF:1 this means tha CALL with ID=1 is started
    • CONN:1,0 this means the connection of CALL with ID =1 has received response from remote phone
AT Command - make call

AT Command – make call

  • Using AT^DDSETEX=2 after the voice call is established and open another Teraterm on COM port with description “3G APPLICATION ….” you can see the binary streaming of incoming voice (you can see strange symbols that follow the flux of destination phone speaker voice); the follow is an example of received voice binary stream:

AT-command : binary voice stream

  • Hangup the call using ATHcommand, the monitor shows:
    • CEND:1,48,29,16 means that CALL with ID=1, duration 48 seconds, call endded by the client end (code 104), normal call clearing (code 16)

and now…receive a call

  • Use phone to call USB dongle SIM number
  • Serial monitor prints:
    • CRING:VOICE means phone is ringing for incoming VOICE call
    • CLIP:<phone number>,145,,,,0 menas that incoming call come from showed <phone number>, is an international call (code 145: dialling string includes international access code character “+”), CLI valid (code 0)
  • Respond to incoming call with command ATA, the response is CONN1,0
  • Redirect the incoming audio stream to COM port with AT^DDSETEX=2 and try to talk into the phone.
  • Hangup the call using remote phone, the monitor shows:
    • CEND:1,28,104,16 means that CALL with ID=1, duration 28 seconds, the network release the call (code 104), normal call clearing (code 16)
AT command: receive call

AT command: receive call

More information on AT command and meanings can found on this documents:

AT command reference link N1

AT command reference link N2

AT command reference link N3

CONCLUSION

We have now all AT commands to make and receive voice calls. In the next episode I will show you the JAVA software that organize this AT commands and redirect voice stream to PC device to  hear and send your voice over the GSM network.

See you soon, and happy hacking!

Post Navigation