{"id":13400484,"url":"https://github.com/miconda/sipexer","last_synced_at":"2025-05-16T06:07:03.627Z","repository":{"id":39801274,"uuid":"440819916","full_name":"miconda/sipexer","owner":"miconda","description":"Modern and flexible SIP/VoIP cli tool","archived":false,"fork":false,"pushed_at":"2025-03-25T15:49:57.000Z","size":282,"stargazers_count":342,"open_issues_count":2,"forks_count":43,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-08T16:06:34.712Z","etag":null,"topics":["go","golang","sip","telephony","voip","webrtc","websocket"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miconda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["miconda"]}},"created_at":"2021-12-22T10:30:25.000Z","updated_at":"2025-04-06T13:47:31.000Z","dependencies_parsed_at":"2023-02-15T22:01:09.839Z","dependency_job_id":"f17375ed-7bdb-43c0-9938-45f32bd3d466","html_url":"https://github.com/miconda/sipexer","commit_stats":{"total_commits":245,"total_committers":6,"mean_commits":"40.833333333333336","dds":"0.020408163265306145","last_synced_commit":"96a1649470e0bead2ddb3cfbc080dc8021b1f7b6"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miconda%2Fsipexer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miconda%2Fsipexer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miconda%2Fsipexer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miconda%2Fsipexer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miconda","download_url":"https://codeload.github.com/miconda/sipexer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478190,"owners_count":22077676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","sip","telephony","voip","webrtc","websocket"],"created_at":"2024-07-30T19:00:52.516Z","updated_at":"2025-05-16T06:06:58.614Z","avatar_url":"https://github.com/miconda.png","language":"Go","funding_links":["https://github.com/sponsors/miconda"],"categories":["Go","Operations"],"sub_categories":["Testing"],"readme":"# sipexer #\n\nModern and flexible SIP ([RFC3261](https://datatracker.ietf.org/doc/html/rfc3261)) command line tool.\n\nProject URL:\n\n  * https://github.com/miconda/sipexer\n\n**Table Of Content**\n\n  * [Overview](#overview)\n  * [Features](#features)\n  * [Installation](#installation)\n    + [Compile From Sources](#compile-from-sources)\n    + [Download Binary Release](#download-binary-release)\n  * [Usage](#usage)\n    + [Examples](#examples)\n  * [Target Address](#target-address)\n  * [Message Template](#message-template)\n    + [Template Data](#template-data)\n    + [Template Fields](#template-fields)\n  * [Alternatives](#alternatives)\n  * [License](#license)\n  * [Contributions](#contributions)\n\n## Overview\n\n`sipexer` is a cli tool that facilitates sending SIP requests to servers. It uses a flexible template\nsystem to allow defining many parts of the SIP request via command line parameters. It has support\nfor UDP, TCP, TLS and WebSocket transport protocols, being suitable to test modern WebRTC SIP servers.\n\n`sipexer` is not a SIP cli softphone, but a tool for crafting SIP requests mainly for the purpose\nof testing SIP signaling routing or monitoring servers.\n\nIt is written in Go, aiming to be usable from Linux, MacOS or Windows.\n\nThe meaning of the name `sipexer`: randomly selected to be easy to write and pronounce,\nquickly after thought of it as the shortening of `SIP EXEcutoR`.\n\n`sipexer` in action sending a SIP OPTIONS request:\n\n![SIP OPTIONS Request](https://github.com/miconda/sipexer/raw/main/misc/img/sipexer-options.gif)\n\n## Features\n\nAmong features:\n\n  * send OPTIONS request (quick SIP ping to check if server is alive)\n  * do registration and un-registration with customized expires value\n  and contact URI\n  * authentication with plain or HA1 passwords\n  * set custom SIP headers\n  * template system for building SIP requests\n  * fields in the templates can be set via command line parameters or a JSON file\n  * variables for setting field values (e.g., random number, data, time, environment\n  variables, uuid, random string, ...)\n  * simulate SIP calls at signaling layer (INVITE-wait-BYE)\n  * option for late-offer SDP\n  * respond to requests coming during SIP calls (e.g., OPTIONS keepalives)\n  * send instant messages with SIP MESSAGE requests\n  * color output mode for easier troubleshooting\n  * support for many transport layers: IPv4 and IPv6, UDP, TCP, TLS and WebSocket (for WebRTC)\n  * send SIP requests of any type (e.g., INFO, SUBSCRIBE, NOTIFY, ...)\n\n## Installation\n\n### Compile From Sources\n\nFirst install [Go](http://golang.org). Once the Go environment is configured, clone `sipexer` git repository:\n\n```\ngit clone https://github.com/miconda/sipexer\n```\n\nDownload dependencies and build:\n\n```\ncd sipexer\ngo get ./...\ngo build .\n```\n\nThe binary `sipexer` should be generated in the current directory.\n\n**Note:** On some OS distributions, it may be required to run the `go build` command\nwith `CGO_ENABLED=0`, like:\n\n```\nCGO_ENABLED=0 go build .\n```\n\n### Download Binary Release\n\nBinary releases for `Linux`, `MacOS` and `Windows` are available at:\n\n  * https://github.com/miconda/sipexer/releases\n\n## Usage\n\nPrototype:\n\n```\nsipexer [options] [target]\n```\n\nSee `sipexer -h` for the command line options and arguments.\n\nDefaults:\n  * target address: `sip:127.0.0.1:5060`\n  * SIP method: `OPTIONS`\n  * From user: `alice`\n  * From domain: `localhost`\n  * To user: `bob`\n  * To domain: `localhost`\n\n### Examples\n\nSend an `OPTIONS` request over `UDP` to `127.0.0.1` and port `5060` - couple of variants:\n\n```\nsipexer\nsipexer 127.0.0.1\nsipexer 127.0.0.1 5060\nsipexer udp 127.0.0.1 5060\nsipexer udp:127.0.0.1:5060\nsipexer sip:127.0.0.1:5060\nsipexer \"sip:127.0.0.1:5060;transport=udp\"\n```\n\nSpecify a different R-URI:\n\n```\nsipexer -ruri sip:alice@server.com udp:127.0.0.1:5060\n```\n\nSend from UDP local port 55060:\n\n```\nsipexer -laddr 127.0.0.1:55060 udp:127.0.0.1:5060\n```\n\nSend `REGISTER` request with generated contact, expires as well as user and password authentication:\n\n```\nsipexer -register -cb -ex 600 -au alice -ap test123 udp:127.0.0.1:5060\n```\n\nSend `REGISTER` request with expires 60s, wait 20000ms (20s) and then unregister:\n\n```\nsipexer -register -vl 3 -co -com -ex 60 -fuser alice -cb -ap \"abab...\" -ha1 -sd -sw 20000 udp:127.0.0.1:5060\n```\n\nSet `fuser` field to `carol`:\n\n```shell\nsipexer -sd -fu \"carol\" udp:127.0.0.1:5060\n# or \nsipexer -sd -fv \"fuser:carol\" udp:127.0.0.1:5060\n```\n\nSet `fuser` field to `carol` and `tuser` field to `david`, with\nR-URI user same as To-user when providing proxy address destination:\n\n```shell\nsipexer -sd -fu \"carol\"  -tu \"david\" -su udp:127.0.0.1:5060\n# or\nsipexer -sd -fv \"fuser:carol\"  -fv \"tuser:david\" -su udp:127.0.0.1:5060\n```\n\nAdd extra headers:\n\n```\nsipexer -sd -xh \"X-My-Key:abcdefgh\" -xh \"P-Info:xyzw\" udp:127.0.0.1:5060\n```\n\nSend `MESSAGE` request with body:\n\n```\nsipexer -message -mb 'Hello!' -sd -su udp:127.0.0.1:5060\n```\n\nSend `MESSAGE` request with body over `tcp`:\n\n```\nsipexer -message -mb 'Hello!' -sd -su tcp:127.0.0.1:5060\n```\n\nSend `MESSAGE` request with body over `tls`:\n\n```\nsipexer -message -mb 'Hello!' -sd -su tls:127.0.0.1:5061\n```\n\nSend `MESSAGE` request with body over `wss` (WebSocket Secure):\n\n```\nsipexer -message -mb 'Hello!' -sd -su wss://server.com:8443/sip\n```\n\nSend `INVITE` request with default From user `alice` and To user `bob`:\n\n```\nsipexer -invite -vl 3 -co -com -sd -su udp:server.com:5060\n```\n\nInitiate a call from `alice` to `bob`, with user authentication providing the\npassword in HA1 format, waiting 10000 milliseconds before sending the `BYE`,\nwith higher verbosity level (`3`) and color printing:\n\n```shell\nsipexer -invite -vl 3 -co -com -fuser alice -tuser bob -cb -ap \"4a4a4a4a4a...\" -ha1 -sw 10000 -sd -su udp:server.com:5060\n```\n\n## Target Address\n\nThe target address can be provided as last arguments to the `sipexer` command. It is\noptional, if not provided, then the SIP message is sent over `UDP` to `127.0.0.1` port `5060`.\n\nThe format can be:\n\n  * SIP URI (e.g., `sip:user@server.com:5080;transport=tls`)\n  * SIP proxy socket address in format `proto:host:port` (e.g., `tls:server.com:5061`)\n  * WSS URL (e.g., `wss://server.com:8442/webrtc`)\n  * only the server `hostname` or `IP` (e.g., `server.com`)\n  * `host:port` (transport protocol is set to `UDP`)\n  * `proto:host` (port is set to `5060`)\n  * `host port` (transport protocol is set to `UDP`)\n  * `proto host` (port is set to `5060`)\n  * `proto host port` (same as `proto:host:port`)\n\n\n## Message Template\n\n### Template Data\n\nThe message to be sent via the SIP connection is built from a template file and a fields file.\n\nThe template file can contain any any of the directives supported by Go package `text/template` - for more see:\n\n  * https://golang.org/pkg/text/template/\n\nExample:\n\n```\n{{.method}} {{.ruri}} SIP/2.0\nVia: SIP/2.0/{{.viaproto}} {{.viaaddr}}{{.rport}};branch=z9hG4bKSG.{{.viabranch}}\nFrom: {{if .fname}}\"{{.fname}}\" {{end}}\u003csip:{{if .fuser}}{{.fuser}}@{{end}}{{.fdomain}}\u003e;tag={{.fromtag}}\nTo: {{if .tname}}\"{{.tname}}\" {{end}}\u003csip:{{if .tuser}}{{.tuser}}@{{end}}{{.tdomain}}\u003e\nCall-ID: {{.callid}}\nCSeq: {{.cseqnum}} {{.method}}\n{{if .subject}}Subject: {{.subject}}{{else}}$rmeol{{end}}\n{{if .date}}Date: {{.date}}{{else}}$rmeol{{end}}\n{{if .contacturi}}Contact: {{.contacturi}}{{if .contactparams}};{{.contactparams}}{{end}}{{else}}$rmeol{{end}}\n{{if .expires}}Expires: {{.expires}}{{else}}$rmeol{{end}}\n{{if .useragent}}User-Agent: {{.useragent}}{{else}}$rmeol{{end}}\nContent-Length: 0\n\n```\n\nExample SDP body template:\n\n```\nv=0{{.cr}}\no={{.sdpuser}} {{.sdpsessid}} {{.sdpsessversion}} IN {{.sdpaf}} {{.localip}}{{.cr}}\ns=call{{.cr}}\nc=IN {{.sdpaf}} {{.localip}}{{.cr}}\nt=0 0{{.cr}}\nm=audio {{.sdprtpport}} RTP 0 8 101{{.cr}}\na=rtpmap:0 pcmu/8000{{.cr}}\na=rtpmap:8 pcma/8000{{.cr}}\na=rtpmap:101 telephone-event/8000{{.cr}}\na=sendrecv{{.cr}}\n```\n\nThe internal templates can be found at the top of `sipexer.go` file:\n\n  * https://github.com/miconda/sipexer/blob/main/sipexer.go\n\n### Template Fields\n\nThe fields file has to contain a JSON document with the fields to be replaced\nin the template file. The path to the JSON file is provided via `-ff` or `--fields-file`\nparameters.\n\nWhen the `--fields-eval` of `-fe` cli option is provided, `sipexer` evaluates the values of the\nfields in the root structure of the JSON document. That means special tokens (expressions)\nare replaced if the value of the field is a string matching one of the next:\n\n  * `\"$cr\"` - replace with `\\r`\n  * `\"$dateansic\"` - replace with output of `time.Now().Format(time.ANSIC)`\n  * `\"$datefull\"` - replace with output of `time.Now().String()`\n  * `\"$daterfc1123\"` - replace with output of `time.Now().Format(time.RFC1123)`\n  * `\"$dateunix\"` - replace with output of `time.Now().Format(time.UnixDate)`\n  * `\"$env(name)\"` - replace with the value of the environment variable `name`\n  * `\"$add(name)\"` - return the current value associate with `name` plus `1` (initial value is `0`)\n  * `\"$add(name,val)\"` - return the current value associate with `name` plus `val` (initial value is `0`)\n  * `\"$sub(name)\"` - return the current value associate with `name` minus `1` (initial value is `0`)\n  * `\"$sub(name,val)\"` - return the current value associate with `name` minus `val` (initial value is `0`)\n  * `\"$mul(name,val)\"` - return the current value associate with `name` multiplied with `val` (initial value is `1`)\n  * `\"$div(name,val)\"` - return the current value associate with `name` divided by `val` (initial value is `1`)\n  * `\"$dec(name)\"` - return the decremented value, first to return is 999999\n  * `\"$dec(name,val)\"` - return the decremented value, first to return is`val - 1`\n  * `\"$inc(name)\"` - return the incremented value, first to return is 1\n  * `\"$inc(name,val)\"` - return the incremented value, first to return is`val + 1`\n  * `\"$randseq\"` - replace with a random number from `1` to `1 000 000`\n  * `\"$rand(max)\"` - replace with a random number from `0` to `max`\n  * `\"$rand(min,max)\"` - replace with a random number from `min` to `max`\n  * `\"$randan(len)\"` - random alphanumeric string of length `len`\n  * `\"$randan(minlen,maxlen)\"` - random alphanumeric string with length from `minlen` to `maxlen`\n  * `\"$randhex(len)\"` - random hexadecimal string of length `len`\n  * `\"$randhex(minlen,maxlen)\"` - random hexadecimal string with length from `minlen` to `maxlen`\n  * `\"$randnum(len)\"` - random numeric string of length `len`\n  * `\"$randnum(minlen,maxlen)\"` - random numeric string with length from `minlen` to `maxlen`\n  * `\"$randstr(len)\"` - random alphabetic string of length `len`\n  * `\"$randstr(minlen,maxlen)\"` - random alphabetic string with length from `minlen` to `maxlen`\n  * `\"$rmeol\"` - remove next end of line character `\\n`\n  * `\"$timestamp\"` - replace with output of `time.Now().Unix()` - time stamp in seconds\n  * `\"$timems\"` - replace with output of `time.Now().UnixMilli()` - time stamp in milliseconds\n  * `\"$lf\"` - replace with `\\n`\n  * `\"$uuid\"` - replace with a UUID (universally unique identifier) value\n\nWhen internal template is used, `--fields-eval` is turned on.\n\nExample fields file:\n\n```json\n{\n\t\"method\": \"OPTIONS\",\n\t\"fuser\": \"alice\",\n\t\"fdomain\": \"localhost\",\n\t\"tuser\": \"bob\",\n\t\"tdomain\": \"localhost\",\n\t\"viabranch\": \"$uuid\",\n\t\"rport\": \";rport\",\n\t\"fromtag\": \"$uuid\",\n\t\"totag\": \"\",\n\t\"callid\": \"$uuid\",\n\t\"cseqnum\": \"$randseq\",\n\t\"date\": \"$daterfc1123\",\n\t\"sdpuser\": \"sipexer\",\n\t\"sdpsessid\": \"$timestamp\",\n\t\"sdpsessversion\": \"$timestamp\",\n\t\"sdpaf\": \"IP4\",\n\t\"sdprtpport\": \"$rand(20000,40000)\"\n}\n```\n\nThe internal fields data can be found at the top of `sipexer.go` file.\n\nThe values for fields can be also provided using `--field-val` or `-fv` cli parameter, in\nformat `name:value`, for example:\n\n```\nsipexer --field-val=\"domain:openrcs.com\" ...\n```\n\nThe value provided via `--field-val` overwrites the value provided in the\nJSON fields file.\n\nWhen sending out, before the template is evaluated, the following fields are also\nadded internally and will replace the corresponding `{{.name}}` (e.g., `{{.proto}}`)\nin the template:\n\n  * `afver` - address family version (`4` or `6`)\n  * `localaddr` - local address - `ip:port`\n  * `localip` - local ip\n  * `localport` - local port\n  * `proto` - lower(`proto`) (e.g., `udp`, `tcp`, ...)\n  * `protoup` - upper(`proto`) (e.g., `UDP`, `TCP`, ...)\n  * `sdpaf` - SDP address family (`IP4` or `IP6`)\n  * `targetaddr` - remote address - `ip:port`\n  * `targetip` - remote ip\n  * `targetport` - remote port\n  * `cr` - `\\r`\n  * `lf` - `\\n`\n  * `tab` - `\\t`\n\n\n## Alternatives\n\nThere are several alternatives that might be useful to consider:\n\n  * `sipp` - SIP testing tool using XML-based scenarios\n  * `sipsak` - SIP swiss army knife - SIP cli testing tool\n  * `wsctl` - WebSocket cli tool with basic support for SIP\n  * `baresip` - cli SIP softphone\n  * `pjsua` - cli SIP softphone\n\n## License\n\n`GPLv3`\n\nCopyright: `Daniel-Constantin Mierla` ([Asipto](https://www.asipto.com))\n\n## Contributions\n\nContributions are welcome!\n\nFork and do pull requests:\n\n  * https://github.com/miconda/sipexer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiconda%2Fsipexer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiconda%2Fsipexer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiconda%2Fsipexer/lists"}