Skip to content

Instantly share code, notes, and snippets.

@eugenesan
Last active December 1, 2022 15:24
Show Gist options
  • Save eugenesan/c911c7c062557d67f6f8603a4c79c3f9 to your computer and use it in GitHub Desktop.
Save eugenesan/c911c7c062557d67f6f8603a4c79c3f9 to your computer and use it in GitHub Desktop.
Simulate modem/fax using SIP+t.38
#!/bin/bash -x
# Simulate modem/fax using SIP+t.38
# Version 0.4 (reduced)
# http://www.voip-info.org/wiki/view/T38modem+SIP+configuration+with+Callcentric
# http://t38modem.cvs.sourceforge.net/viewvc/t38modem/t38modem/ReadMe.txt
#
# efax-gtk params:
# Initial: Z &FE&D2S7=120 &C0 M1L0; Reset: Z
# Serial: ../tmp/t38modem; Class: Auto; Dial: Tone
# UseGTKPrintSystem: True, SendFaxResolution: Fine
F_DEBUG="-tt"
F_PTY="/tmp/t38modem" # Set "Serial Device" at efax-gtk to ../tmp/t38modem since it defaults to /dev
#F_FORCE_FAX="--sip-disable-t38-mode"
F_FORCE_FAX="--force-fax-mode --no-force-t38-mode"
#F_FORCE_CODECS=";OPAL-Enable-Audio=!*"
F_SIP_ID="user"
F_SIP_PASSWORD="passsword"
#read -p "SIP Password:" F_SIP_PASSWORD
F_SIP_DOMAIN="domain.com"
# Include credentials from config
#. ~/.fax.rc
# Setup incoming UDP mapping
#IPPORTEXT="5060"
#IPPORTINT="5060"
#IPPROTO="UDP"
#IPADDRINT="$(upnpc -s | grep "^Local" | cut -f2 -d':' | cut -f2 -d' ')"
#echo "OurIP: ${IPADDRINT}"
#UPNPS="$(upnpc -l | grep -e "${IPPROTO}.*${IPPORTEXT}->${IPADDRINT}:${IPPORTINT}.*libminiupnpc")"
#echo "UpnpStateBefore: ${UPNPS}"
#if [ -z "${UPNPS}" ]; then
# upnpc -d ${IPPORTEXT} UDP
# upnpc -a ${IPADDRINT} ${IPPORTINT} ${IPPORTEXT} UDP
#fi
# Start modem simulation
t38modem ${F_DEBUG} ${F_FORCE_FAX} --no-h323 -p +${F_PTY} \
--route "modem:.*=sip:<dn>@${F_SIP_DOMAIN}${F_FORCE_CODECS}" \
--route "sip:.*=modem:<dn>" \
--sip-proxy ${F_SIP_ID}:${F_SIP_PASSWORD}@${F_SIP_DOMAIN} \
--sip-register ${F_SIP_ID}@${F_SIP_DOMAIN},${F_SIP_PASSWORD} \
--sip-listen "udp\$*:5060"
# --sip-no-listen \
# --force-fax-mode --no-force-t38-mode
# --sip-listen "${IPPROTO}\$${IPADDRINT}:${IPPORTINT}" \
# -u ${F_SIP_ID} \
# --stun stun.ekiga.net \
# Disable incomming SIP mapping
#upnpc -d ${IPPORTEXT} UDP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment