emiago / gophone

Gophone CLI SIP phone powered by SIPGO
BSD 2-Clause "Simplified" License
45 stars 1 forks source link
SIPGO

GOPHONE is single binary CLI SIP Softphone written in GO and powered by sipgox and sipgo

gophone dial -media=audio sip:alice@sip.dev.server:5060

NOT Open Source, but most of code is on libraries mentioned with exception for some some audio processing and media setup. This also shows power of this libs. It is mainly developed for simple automated testing purpose.

Any feature/bug or supporting this is open for discussion, but for now development time/focus is more on libraries.

Cross Platform builds:

For audio it expected you have some preinstalled libraries.

Major features:

Roadmap/Features:

Quick start

Install

gophone is single binary so you only need to download and run it.

You can Download from here or here quick links

Usage

$>gophone -h
Usage of gophone command:

Commands:
  dial          Dial destination.
  answer        Answer call
  register      Send register request only without answer.

  -t string
        Transport udp|tcp|tls|ws|wss (default "udp")

Enviroment variables:
  LOG_LEVEL=debug|info|error            Log level for output. Default=info
  LOG_FORMAT=json|console               Log format for output. Default=console
  LOG_NOCOLOR                           Disable color
  SIP_DEBUG                             LOG SIP traffic. Used with LOG_LEVEL=debug
  RTP_DEBUG                             LOG RTP traffic. Used with LOG_LEVEL=debug
  RTCP_DEBUG                            LOG RTCP traffic. Used with LOG_LEVEL=debug
  GOPHONE_MEDIA=<same as -media>        Sets default media in case of calls

gophone is CLI SIP softphone powered by sipgo library.
To find more information about tool and licences visit
https://github.com/emiago/gophone

Answer:
gophone answer -l 127.0.0.200:5060 
gophone answer -l 127.0.0.200:5060 -code 486 -reason Busy

Answer with register:
gophone  answer -ua alice -username alice1234 -password 1234 -register "127.0.0.1:5060"

Dial:
gophone dial sip:1234@127.0.0.200:5060
gophone dial -sipheader="X-AccountId:test123" sip:1234@server:5060

Register:
gophone register -username=sipgo -password=1234 127.0.0.1:5060 

With digest authentication:
gophone dial -ua alice -username=alice1234 -password=1234 "sip:echo@server:5060"

With media:
gophone dial -media=audio sip:1234@localhost:5060
gophone dial -media=mic sip:1234@localhost:5060
gophone answer -media=speaker

With transcribe:
gophone dial -media=log -transcribe sip:1234@localhost:5060

With DTMF:
gophone dial -dtmf=79 -dtmf_delay=8s -dtmf_digit_delay=1s -media=speaker sip:1234@localhost:5060

With INTERACTIVE mode:
echo "wait=3s; dtmf=123; hangup;" | gophone dial -i -media=speaker sip:demo@127.0.0.1:5060

Output example

Running a full call and transcription output at end.

output with transcription

Using jq and json format to verify output

Using json allows some post verification for your call setup.

output with jq filtering

Useful filtering

gophone ... | jq 'select(.caller=="Dial" and .event=="SIP")'
gophone ... | jq 'select(.caller=="Dial" and .event=="DialogState")'

Media Testing with transcriber

CALLTRANSCRIPTION=$(LOG_FORMAT=json gophone dial -transcribe sip:49123456789@carrier.xy \
    | jq -r 'select(.caller=="Transcriber" and .text != null) | .text')

test "Please enter your PIN. Your answer is, 1234." = $CALLTRANSCRIPTION