Skip to content

Instantly share code, notes, and snippets.

@sfgeorge
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfgeorge/9ee2ec7fbc91447e837c to your computer and use it in GitHub Desktop.
Save sfgeorge/9ee2ec7fbc91447e837c to your computer and use it in GitHub Desktop.
ngrep ASR request/response example
$ nice sudo ngrep -W byline -qt 'grammar|RECOGNITION-COMPLETE|IN-PROGRESS'
interface: eth0 (192.168.10.0/255.255.254.0)
match: grammar|RECOGNITION-COMPLETE
T 2014/06/25 23:15:16.744457 192.168.11.229:41384 -> 192.168.10.208:20103 [AP]
MRCP/2.0 1058 DEFINE-GRAMMAR 1.
Channel-Identifier: bf085f14-f758-4ce2-b@speechrecog.
Content-Type: application/srgs+xml.
Content-Id: grammar-0.
Content-Length: 890.
.
<grammar mode="voice" root="choices" tag-format="semantics/1.0-literals" version="1.0" xml:lang="en-US" xmlns="http://www.w3.org/2001/06/grammar"><rule id="choices" scope="public"><one-of><item>One<tag>1</tag></item><item>Two<tag>2</tag></item><item>Three<tag>3</tag></item><item>4<tag>4</tag></item><item>5<tag>5</tag></item><item>6<tag>6</tag></item><item>7<tag>7</tag></item><item>8<tag>8</tag></item><item>9<tag>9</tag></item><item>Ten<tag>10</tag></item><item>Eleven<tag>11</tag></item><item>Twelve<tag>12</tag></item><item>Thirteen<tag>13</tag></item><item>Fourteen<tag>14</tag></item><item>Fifteen<tag>15</tag></item><item>Sixteen<tag>16</tag></item><item>Seventeen<tag>17</tag></item><item>Eighteen<tag>18</tag></item><item>Nineteen<tag>19</tag></item><item>Twenty<tag>20</tag></item><item>Twenty One<tag>21</tag></item><item>Twenty Two<tag>22</t
T 2014/06/25 23:15:16.744701 192.168.11.229:41384 -> 192.168.10.208:20103 [AP]
ag></item></one-of></rule></grammar>
T 2014/06/25 23:15:16.760386 192.168.11.229:41384 -> 192.168.10.208:20103 [AP]
MRCP/2.0 273 RECOGNIZE 2.
Channel-Identifier: bf085f14-f758-4ce2-b@speechrecog.
Content-Type: text/uri-list.
Cancel-If-Queue: false.
Start-Input-Timers: false.
No-Input-Timeout: 5000.
Dtmf-Interdigit-Timeout: 3000.
Dtmf-Term-Char: #.
Content-Length: 17.
.
session:grammar-0
T 2014/06/25 23:15:23.166582 192.168.10.208:20103 -> 192.168.11.229:41384 [AP]
MRCP/2.0 393 RECOGNITION-COMPLETE 2 COMPLETE.
Channel-Identifier: bf085f14-f758-4ce2-b@speechrecog.
Content-Length: 202.
Completion-Cause: 000 success.
Content-Type: application/nlsml+xml.
.
<?xml version='1.0' encoding='ISO-8859-1' ?><result><interpretation grammar="session:grammar-0" confidence="0.99"><input mode="speech">Twenty One</input><instance>21</instance></interpretation></result>
T 2014/06/25 23:15:23.439691 192.168.11.229:57979 -> 192.168.10.208:20104 [AP]
MRCP/2.0 279 RECOGNIZE 1.
Channel-Identifier: cf3865cd-ffe8-4024-9@speechrecog.
Content-Type: text/uri-list.
Cancel-If-Queue: false.
Start-Input-Timers: false.
Dtmf-Term-Char: #.
No-Input-Timeout: 5000.
Dtmf-Interdigit-Timeout: 3000.
Content-Length: 23.
.
builtin:grammar/boolean
$ sudo ngrep -W byline -qt 'SIP|MRCP'
interface: eth0 (192.168.10.0/255.255.254.0)
match: SIP|MRCP
U 2014/06/25 21:40:41.072169 192.168.11.229:5093 -> 192.168.10.208:5060
INVITE sip:192.168.10.208:5060 SIP/2.0.
Via: SIP/2.0/UDP 192.168.11.229:5093;rport;branch=z9hG4bKpBSvjcZNjeKUH.
Max-Forwards: 70.
From: <sip:0.0.0.0:5093>;tag=NrUp1vgZtytcc.
To: <sip:192.168.10.208:5060>.
Call-ID: b909d6ab-7775-1232-30bd-4ebfc53b7c4d.
CSeq: 903157813 INVITE.
Contact: <sip:0.0.0.0:5093>.
User-Agent: Asterisk.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE.
Supported: timer, 100rel.
Content-Type: application/sdp.
Content-Disposition: session.
Content-Length: 398.
.
v=0.
o=Asterisk 8758909262698189182 4407465806912914105 IN IP4 192.168.11.229.
s=-.
c=IN IP4 192.168.11.229.
t=0 0.
m=application 9 TCP/MRCPv2 1.
a=setup:active.
a=connection:new.
a=resource:speechrecog.
a=cmid:1.
m=audio 4340 RTP/AVP 0 8 96 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:96 L16/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=sendonly.
a=ptime:20.
a=mid:1.
U 2014/06/25 21:40:41.078184 192.168.10.208:5060 -> 192.168.11.229:5093
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 192.168.11.229:5093;rport;branch=z9hG4bKpBSvjcZNjeKUH;received=192.168.11.229.
Contact: <sip:mrcpserver@192.168.10.208:5060>.
To: <sip:192.168.10.208:5060>;tag=b9031f7f.
From: <sip:0.0.0.0:5093>;tag=NrUp1vgZtytcc.
Call-ID: b909d6ab-7775-1232-30bd-4ebfc53b7c4d.
CSeq: 903157813 INVITE.
User-Agent: LumenVox Media Server/12.1.100.
Allow: INVITE, OPTIONS, ACK, BYE, UPDATE.
Supported: timer.
Content-Type: application/sdp.
Content-Disposition: session.
Content-Length: 348.
.
v=0.
o=- 1234 5678 IN IP4 192.168.10.208.
s=-.
c=IN IP4 192.168.10.208.
t=0 0.
m=audio 25160 RTP/AVP 0 96.
c=IN IP4 192.168.10.208.
a=rtpmap:0 PCMU/8000.
a=rtpmap:96 telephone-event/8000.
a=fmtp:96 0-15.
a=recvonly.
a=mid:1.
m=application 20080 TCP/MRCPv2 1.
a=setup:passive.
a=connection:new.
a=channel:e22e9365-f77c-421f-a@speechrecog.
a=cmid:1.
U 2014/06/25 21:40:41.078745 192.168.11.229:5093 -> 192.168.10.208:5060
ACK sip:mrcpserver@192.168.10.208:5060 SIP/2.0.
Via: SIP/2.0/UDP 192.168.11.229:5093;rport;branch=z9hG4bKQmjNm7FSFQ9DD.
Max-Forwards: 70.
From: <sip:0.0.0.0:5093>;tag=NrUp1vgZtytcc.
To: <sip:192.168.10.208:5060>;tag=b9031f7f.
Call-ID: b909d6ab-7775-1232-30bd-4ebfc53b7c4d.
CSeq: 903157813 ACK.
Contact: <sip:0.0.0.0:5093>.
Content-Length: 0.
.
T 2014/06/25 21:40:44.101974 192.168.11.229:37116 -> 192.168.10.208:20080 [AP]
MRCP/2.0 1058 DEFINE-GRAMMAR 1.
Channel-Identifier: e22e9365-f77c-421f-a@speechrecog.
Content-Type: application/srgs+xml.
Content-Id: grammar-0.
Content-Length: 890.
.
<grammar mode="voice" root="choices" tag-format="semantics/1.0-literals" version="1.0" xml:lang="en-US" xmlns="http://www.w3.org/2001/06/grammar"><rule id="choices" scope="public"><one-of><item>One<tag>1</tag></item><item>Two<tag>2</tag></item><item>Three<tag>3</tag></item><item>4<tag>4</tag></item><item>5<tag>5</tag></item><item>6<tag>6</tag></item><item>7<tag>7</tag></item><item>8<tag>8</tag></item><item>9<tag>9</tag></item><item>Ten<tag>10</tag></item><item>Eleven<tag>11</tag></item><item>Twelve<tag>12</tag></item><item>Thirteen<tag>13</tag></item><item>Fourteen<tag>14</tag></item><item>Fifteen<tag>15</tag></item><item>Sixteen<tag>16</tag></item><item>Seventeen<tag>17</tag></item><item>Eighteen<tag>18</tag></item><item>Nineteen<tag>19</tag></item><item>Twenty<tag>20</tag></item><item>Twenty One<tag>21</tag></item><item>Twenty Two<tag>22</t
T 2014/06/25 21:40:44.112354 192.168.10.208:20080 -> 192.168.11.229:37116 [AP]
MRCP/2.0 116 1 200 COMPLETE.
Channel-Identifier: e22e9365-f77c-421f-a@speechrecog.
Completion-Cause: 000 success.
.
T 2014/06/25 21:40:44.120056 192.168.11.229:37116 -> 192.168.10.208:20080 [AP]
MRCP/2.0 273 RECOGNIZE 2.
Channel-Identifier: e22e9365-f77c-421f-a@speechrecog.
Content-Type: text/uri-list.
Cancel-If-Queue: false.
Start-Input-Timers: false.
Dtmf-Term-Char: #.
No-Input-Timeout: 5000.
Dtmf-Interdigit-Timeout: 3000.
Content-Length: 17.
.
session:grammar-0
T 2014/06/25 21:40:44.122020 192.168.10.208:20080 -> 192.168.11.229:37116 [AP]
MRCP/2.0 87 2 200 IN-PROGRESS.
Channel-Identifier: e22e9365-f77c-421f-a@speechrecog.
.
T 2014/06/25 21:40:47.684077 192.168.11.229:37116 -> 192.168.10.208:20080 [AP]
MRCP/2.0 90 START-INPUT-TIMERS 3.
Channel-Identifier: e22e9365-f77c-421f-a@speechrecog.
.
T 2014/06/25 21:40:47.684533 192.168.10.208:20080 -> 192.168.11.229:37116 [AP]
MRCP/2.0 84 3 200 COMPLETE.
Channel-Identifier: e22e9365-f77c-421f-a@speechrecog.
.
T 2014/06/25 21:40:51.967056 192.168.10.208:20080 -> 192.168.11.229:37116 [AP]
MRCP/2.0 156 START-OF-INPUT 2 IN-PROGRESS.
Channel-Identifier: e22e9365-f77c-421f-a@speechrecog.
Input-Type: speech.
Proxy-Sync-Id: 4fbbe630-a737-4ef1-8.
.
T 2014/06/25 21:40:54.466927 192.168.10.208:20080 -> 192.168.11.229:37116 [AP]
MRCP/2.0 393 RECOGNITION-COMPLETE 2 COMPLETE.
Channel-Identifier: e22e9365-f77c-421f-a@speechrecog.
Content-Length: 202.
Completion-Cause: 000 success.
Content-Type: application/nlsml+xml.
.
<?xml version='1.0' encoding='ISO-8859-1' ?><result><interpretation grammar="session:grammar-0" confidence="0.92"><input mode="speech">Twenty One</input><instance>21</instance></interpretation></result>
U 2014/06/25 21:40:54.506342 192.168.11.229:5093 -> 192.168.10.208:5060
BYE sip:mrcpserver@192.168.10.208:5060 SIP/2.0.
Via: SIP/2.0/UDP 192.168.11.229:5093;rport;branch=z9hG4bKrXBep20vc0Z0r.
Max-Forwards: 70.
From: <sip:0.0.0.0:5093>;tag=NrUp1vgZtytcc.
To: <sip:192.168.10.208:5060>;tag=b9031f7f.
Call-ID: b909d6ab-7775-1232-30bd-4ebfc53b7c4d.
CSeq: 903157814 BYE.
Contact: <sip:0.0.0.0:5093>.
User-Agent: Asterisk.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE.
Supported: timer, 100rel.
Content-Length: 0.
.
U 2014/06/25 21:40:54.506751 192.168.10.208:5060 -> 192.168.11.229:5093
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 192.168.11.229:5093;rport;branch=z9hG4bKrXBep20vc0Z0r.
From: <sip:0.0.0.0:5093>;tag=NrUp1vgZtytcc.
To: <sip:192.168.10.208:5060>;tag=b9031f7f.
Call-ID: b909d6ab-7775-1232-30bd-4ebfc53b7c4d.
CSeq: 903157814 BYE.
Contact: <sip:mrcpserver@192.168.10.208:5060>.
User-Agent: LumenVox Media Server/12.1.100.
Allow: INVITE, OPTIONS, ACK, BYE, UPDATE.
Content-Length: 0.
.
U 2014/06/25 21:40:54.914507 192.168.11.229:5093 -> 192.168.10.208:5060
INVITE sip:192.168.10.208:5060 SIP/2.0.
Via: SIP/2.0/UDP 192.168.11.229:5093;rport;branch=z9hG4bKS646QXH098NKm.
Max-Forwards: 70.
From: <sip:0.0.0.0:5093>;tag=p1mF3Q12Q7gZQ.
To: <sip:192.168.10.208:5060>.
Call-ID: c149f9f7-7775-1232-30bd-4ebfc53b7c4d.
CSeq: 903157814 INVITE.
Contact: <sip:0.0.0.0:5093>.
User-Agent: Asterisk.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE.
Supported: timer, 100rel.
Content-Type: application/sdp.
Content-Disposition: session.
Content-Length: 398.
.
v=0.
o=Asterisk 5376104150470094905 6813843121762975220 IN IP4 192.168.11.229.
s=-.
c=IN IP4 192.168.11.229.
t=0 0.
m=application 9 TCP/MRCPv2 1.
a=setup:active.
a=connection:new.
a=resource:speechrecog.
a=cmid:1.
m=audio 4342 RTP/AVP 0 8 96 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:96 L16/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=sendonly.
a=ptime:20.
a=mid:1.
U 2014/06/25 21:40:54.919221 192.168.10.208:5060 -> 192.168.11.229:5093
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 192.168.11.229:5093;rport;branch=z9hG4bKS646QXH098NKm;received=192.168.11.229.
Contact: <sip:mrcpserver@192.168.10.208:5060>.
To: <sip:192.168.10.208:5060>;tag=bc2b9ed8.
From: <sip:0.0.0.0:5093>;tag=p1mF3Q12Q7gZQ.
Call-ID: c149f9f7-7775-1232-30bd-4ebfc53b7c4d.
CSeq: 903157814 INVITE.
User-Agent: LumenVox Media Server/12.1.100.
Allow: INVITE, OPTIONS, ACK, BYE, UPDATE.
Supported: timer.
Content-Type: application/sdp.
Content-Disposition: session.
Content-Length: 348.
.
v=0.
o=- 1234 5678 IN IP4 192.168.10.208.
s=-.
c=IN IP4 192.168.10.208.
t=0 0.
m=audio 25162 RTP/AVP 0 96.
c=IN IP4 192.168.10.208.
a=rtpmap:0 PCMU/8000.
a=rtpmap:96 telephone-event/8000.
a=fmtp:96 0-15.
a=recvonly.
a=mid:1.
m=application 20081 TCP/MRCPv2 1.
a=setup:passive.
a=connection:new.
a=channel:fe405227-044e-49fe-8@speechrecog.
a=cmid:1.
U 2014/06/25 21:40:54.920166 192.168.11.229:5093 -> 192.168.10.208:5060
ACK sip:mrcpserver@192.168.10.208:5060 SIP/2.0.
Via: SIP/2.0/UDP 192.168.11.229:5093;rport;branch=z9hG4bKtFyZSr236Hc6F.
Max-Forwards: 70.
From: <sip:0.0.0.0:5093>;tag=p1mF3Q12Q7gZQ.
To: <sip:192.168.10.208:5060>;tag=bc2b9ed8.
Call-ID: c149f9f7-7775-1232-30bd-4ebfc53b7c4d.
CSeq: 903157814 ACK.
Contact: <sip:0.0.0.0:5093>.
Content-Length: 0.
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment