1. Home
  2. Docs
  3. HTTP API of Decoders
  4. 6 Sip module

6 Sip module

Gain SIP account list

API instruction

Gain SIP account list

Request

  • Method: GET/POST
  • URL: sip/list.json
  • Headers:
  • submit parameter: no

Response

  • Body
{
  "result": "ok",
  "data": [
    {
      "created": true,
      "type": "gb28181",
      "name": "1112",
      "id": 1
    },
    {
      "created": true,
      "type": "sip",
      "name": "siptest",
      "id": 2
    }
  ]
}
  • return instruction:
field type instruction
id alphabetic string account ID
type alphabetic string account type,”gb28181” or”Ssip”
name alphabetic string account name
created boolean
Whether the account is created or not,true:created、false:not created

test needed:

http://192.168.2.123/api/sip/list.json

Add SIP account

API instruction

Add SIP account

Request

  • Method: GET/POST
  • URL: sip/add.json
  • Headers:
  • submit parameter:
field type instruction
name alphabetic string SIP service name
type alphabetic string SIP service type

Response

  • Body
{
  "result": "ok"
}

test calling:

http://192.168.2.123/api/sip/add.json?name=siptest&type=sip

Modify SDI configuration

API instruction

Modify SDI configuration

Request

  • Method: GET/POST
  • URL: sip/modify.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string SIP account ID
name alphabetic string SIP account name
type alphabetic string SIP account type,value:”sip” or “gb28181”
localAccount alphabetic string SIP local account
localAddress alphabetic string bound address of local server,for example:”*:5060”
realm alphabetic string server or Realm,for example :”*”
serverId alphabetic string sipserver configuration ID
registerServer alphabetic string sip registered server address
registerPort alphabetic string sip resistered server port, for example”5060”
username alphabetic string sip registered user name
password alphabetic string sip registered passord

Response

  • Body
{    "result": "ok"}

test needed:

http://192.168.2.123/api/sip/modify.json?id=2&type=sip&localAccount=123&localAddress=*:5060®isterServer=192.168.0.55®isterPort=5060&realm=*&serverId=sip&username=sip1&password=sip1

Delete SIP account

API说 instruction

Delete SIP account

Request

  • Method: GET/POST
  • URL: sip/remove.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string SIP account id

Response

  • Body
{
  "result": "ok"
}

test interface:

http://192.168.2.123/api/sip/remove.json?id=2

Gain SIP account working status

API instruction

Gain SIP account working status

Request

  • Method: GET/POST
  • URL: sip/status.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string SIP account id

Response

  • Body
{
  "result": "ok",
  "data": [
    {
      "state": "error",
      "id": "account_status"
    },
    {
      "state": "idle",
      "extra_info": 0,
      "id": "register_status"
    },
    {
      "state": "idle",
      "id": "call_status"
    },
    {
      "state": 0,
      "id": "bitrate"
    }
  ]
}

return instruction:

:return includes multi objects

field type instruction
account_status json object account status,state: “error”、”not_created”、 “created”、”idle”
register_status json object Registration status,state: “error”、”registered”、”unregistering”、 “registering”、”closed”、”on”、”off”、 “idle”、”connected”、”disconnected” “reconnecting”、”connecting”
call_status json object call status,state: “idle”、”out”、”in”、”calling”、 “error”、”close”、”reconnecting”
bitrate json object current bit rate,state is numeric types,Unit Kbps

test calling:

http://192.168.2.123/api/sip/status.json?id=1

Gain SIP account information

API instruction

Gain SDI account status

Request

  • Method: GET/POST
  • URL: sip/account.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string SIP account id

Response

  • Body
{
  "result": "ok",
  "data": {
    "gb28181_options": {},
    "call_in_options": {
      "auto_answer": false,
      "allow": true,
      "policy": 1
    },
    "call_out_options": {
      "create_stream": true,
      "target": "",
      "auto_call": false
    },
    "localAddress": "",
    "protocol": "gb28181",
    "source_id": "",
    "serverId": "123",
    "password": "123",
    "registerServer": "192.168.0.16",
    "registerPort": 5060,
    "buffer_option": "live:200:200:500:0:0",
    "localAccount": "1",
    "username": "123",
    "name": "1112",
    "realm": "*"
  }
}

-return instruction

field type instruction
gb28181_options json object gb28181 configuration,not used at the moment
call_in_options json object call parameter configurationb
call_in_options.auto_answer boolean value Automatic reply or not,true, automatic reply、false, not automatic reply
call_in_options.allow boolean value Whether incoming calls are allowed,true, allowed、false, not allowed
call_in_options.policy numercial value call in strategy,state:1、2、3: 1:Only one incoming call is allowed, other incoming calls are rejected 2:Only single incoming calls are allowed, and new incoming calls replace old ones 3:Only single incoming calls are allowed, and new incoming calls replace old ones
call_out_options json object all out parameter configuration
call_out_options.create_stream boolean value Whether it is displayed in the source list or not,true, displayed、false, not displayed
call_out_options.target alphabetic string call out account
call_out_options.auto_call boolean value Automatic call or not,true, Automatic call、false, not Automatic call
source_id alphabetic string video source ID,default””
protocol alphabetic string SIP protocal type,state:”sip” or “gb28181”
localAccount alphabetic string SIP local account
localAddress alphabetic string Local service binding address,如:”*:5060”
realm alphabetic string server or Realm,for example:”*”
serverId alphabetic string sip server configure ID
registerServer alphabetic string sip registration server address
registerPort alphabetic string sip registration server port,for example”5060”
username alphabetic string sip registration user name
password alphabetic string sip registration password
buffer_option alphabetic string bugger parameter,for example:”live:200:200:500:0:0”

test calling:

http://192.168.2.123/api/sip/account.json?id=1

Gain SIP calling configuration

API return instruction

Gain SIP calling configuration

Request

  • Method: GET/POST
  • URL: sip/call_cfg.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string SIP account id

Response

  • Body
{
  "result": "ok",
  "data": {
    "allow_in_num": 1,
    "buffer": "live:200:200:500:0:0",
    "source_id": "",
    "default_name": "",
    "sip_out_url": "",
    "allow_in": 1,
    "source_enable": 1,
    "auto_aws": 0,
    "auto_call": 0
  }
}
  • return instruction:
field type instruction
source_id alphabetic string video source ID,default””
default_name alphabetic string video source ID,default””
sip_out_url alphabetic string sip call address,for example:[email protected].11
allow_in numerical value whether call in is allowed or not,1 allowed ,2 not allowed
auto_aws numerical value Automatic reply or not,true, automatic reply、false, not automatic reply
source_enable numerical value Whether it is displayed in the source list or not,true, displayed、false, not displayed
allow_in_num numerical value Maximum number of permitted calls, default1
buffer_option alphabetic string buffer parameter,for example:”live:200:200:500:0:0”

test calling:

http://192.168.2.123/api/sip/call_cfg.json?id=11

Modify SIP call parameter

API instruction

Modify SIP call parameter

Request

  • Method: GET/POST
  • URL: sip/modify_call_cfg.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string SIP account id
buffer alphabetic string buffer parameter,for example:”live:200:200:500:0:0”,can check interface2.2
source_id alphabetic string video source ID
allow_in alphabetic string whether call in is allowed or not,1 allowed ,2 not allowed
auto_aws alphabetic string Automatic reply or not,true, automatic reply、false, not automatic reply
sip_out_url alphabetic string sip call address,for example:[email protected].11
auto_call alphabetic string Whether automaticlly call or not,1yes,2 no
source_enable alphabetic string whether disaplayed in the source list,1 yes 2 no

Response

  • Body
{
  "result": "ok"
}

test needed:

http://192.168.2.123/api/sip/modify_call_cfg.json?id=1&type=gb28181&allow_in_num=1&buffer=live:200:200:500:0:0&source_id=&default_name=&sip_out_url=&allow_in=1&source_enable=1&auto_aws=0&auto_call=0

Gain SIP bound port list

API insruction

Gain SIP bound port list

Request

  • Method: GET/POST
  • URL: sip/server_port.json
  • Headers:
  • submit parameter: no

Response

  • Body
{
  "result": "ok",
  "data": [
    {
      "name": "*:5060",
      "value": "*:5060"
    }
  ]
}
  • return instruction
field type instruction
name alphabetic string SIP accout id

test interface:

http://192.168.2.123/api/sip/server_port.json?id=3&type=sip

Gain SIP optional decoder source

API instruction

Gain SIP optional decoder source,function not implemented

Request

  • Method: GET/POST
  • URL: sip/get_source.json
  • Headers:
  • submit parameter: no

Response

  • Body
{
  "result": "error",
  "msg": "0000"
}

test interface:

http://192.168.2.123/api/sip/get_source.json

6.11 Gain SIP bound port

API instruction

Gain SIP bound IP and port information

Request

  • Method: GET/POST
  • URL: sip/get_binds.json
  • Headers:
  • submit parameter:no

Response

  • Body
{
  "result": "ok",
  "data": {
    "binds": "*:5060,*.2222"
  }
}

test interface:

http://192.168.2.123/api/sip/get_binds.json

6.12 confugure SIP bound port

API instruction

confugure SIP bound port

Request

  • Method: GET/POST
  • URL: sip/set_binds.json
  • Headers:
  • submit parameter:
    | field | type | instruction
    | ——- | ——— | —————————————— |
    | binds | alphabetic string | multi IP:port alphabetic string,use”,” to seperate |

Response

  • Body
{
  "result":"ok"
}

test interface:

http://192.168.2.123/api/sip/set_binds.json?binds=*:5060,*.2222

SIP receive and response

API instructions

SIP receive and response

Request

  • Method: GET/POST
  • URL: sip/answer.json
  • Headers:
  • submit parameter:
field type instruction
dir alphabetic string call out opposite,”sip_out” 外呼 应答
id alphabetic string SIP account ID

Response

  • Body
{
  "result": "error",
  "msg": "1211"
}

test interface:

http://192.168.2.123/api/sip/answer.json?id=2&dir=sip_out

SIP hang up the connection

API instruction

hang up the connection

Request

  • Method: GET/POST
  • URL: sip/hangup.json
  • Headers:
  • submit parameter:
field type instruction
id alphabetic string SIP account ID

Response

  • Body
{
  "result": "error",
  "msg": "1211"
}

test interface:

http://192.168.2.123/api/sip/hangup.json?id=1

How can we help?