Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.65 KB | None | 0 0
  1. X.X.X.X Upstream Provider
  2.  
  3. X.X.X.71 Upstream Proveder Media Gateway
  4.  
  5. Y.Y.Y.Y MY Kamailio Public IP Address
  6.  
  7. Z.Z.Z.Z Client Public IP Address
  8.  
  9. 172.16.10.146 Client Private IP Address
  10.  
  11.  
  12. ######SIP-FLOW UPSTREAM PROVIDE <---> KAMAILIO
  13.  
  14. INVITE sip:09711895361@X.X.X.X SIP/2.0
  15.  
  16. Via: SIP/2.0/UDP Y.Y.Y.Y:2149;branch=z9hG4bK00E0F51008D6D4843B0E34E42C36
  17.  
  18. From: <sip:09711895150@Y.Y.Y.Y>;tag=00E0F51008D6D4843B0E3E1E80F8
  19.  
  20. To: <sip:09711895361@X.X.X.X>
  21.  
  22. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  23.  
  24. CSeq: 20994 INVITE
  25.  
  26. Contact: <sip:Y.Y.Y.Y:5060>
  27.  
  28. Allow-Events: refer
  29.  
  30. Max-Forwards: 70
  31.  
  32. Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, INFO, REFER, NOTIFY, SUBSCRIBE, UPDATE
  33.  
  34. Content-Type: application/sdp
  35.  
  36. Supported: 100rel, timer, replaces
  37.  
  38. User-Agent: TELES.iSWITCH
  39.  
  40. Content-Length: 312
  41.  
  42.  
  43.  
  44. v=0
  45.  
  46. o=- 379612009 0 IN IP4 Y.Y.Y.Y
  47.  
  48. s=session
  49.  
  50. t=0 0
  51.  
  52. m=audio 6320 RTP/AVP 18 18 18 18 8 0 96
  53.  
  54. c=IN IP4 X.X.X.71
  55.  
  56. a=rtpmap:18 G729/8000
  57.  
  58. a=rtpmap:18 G729A/8000
  59.  
  60. a=rtpmap:18 G729B/8000
  61.  
  62. a=rtpmap:18 G729/8000
  63.  
  64. a=rtpmap:8 PCMA/8000
  65.  
  66. a=rtpmap:0 PCMU/8000
  67.  
  68. a=sendrecv
  69.  
  70. a=rtpmap:96 telephone-event/8000
  71.  
  72. SIP/2.0 100 trying -- your call is important to us
  73.  
  74. Via: SIP/2.0/UDP Y.Y.Y.Y:2149;branch=z9hG4bK00E0F51008D6D4843B0E34E42C36;rport=2149
  75.  
  76. From: <sip:09711895150@Y.Y.Y.Y>;tag=00E0F51008D6D4843B0E3E1E80F8
  77.  
  78. To: <sip:09711895361@X.X.X.X>
  79.  
  80. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  81.  
  82. CSeq: 20994 INVITE
  83.  
  84. Server: kamailio (3.1.3 (i386/linux))
  85.  
  86. Content-Length: 0
  87.  
  88.  
  89.  
  90. SIP/2.0 180 Ringing
  91.  
  92. Via: SIP/2.0/UDP Y.Y.Y.Y:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843B0E34E42C36
  93.  
  94. Record-Route: <sip:X.X.X.X;lr;nat=yes>
  95.  
  96. Contact: <sip:09711895361@Z.Z.Z.Z:40597>
  97.  
  98. To: <sip:09711895361@X.X.X.X>;tag=7a3af13f
  99.  
  100. From: <sip:09711895150@Y.Y.Y.Y>;tag=00E0F51008D6D4843B0E3E1E80F8
  101.  
  102. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  103.  
  104. CSeq: 20994 INVITE
  105.  
  106. User-Agent: X-Lite release 1104o stamp 56125
  107.  
  108. Content-Length: 0
  109.  
  110. P-hint: nated fixed
  111.  
  112.  
  113.  
  114. SIP/2.0 200 OK
  115.  
  116. Via: SIP/2.0/UDP Y.Y.Y.Y:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843B0E34E42C36
  117.  
  118. Record-Route: <sip:X.X.X.X;lr;nat=yes>
  119.  
  120. Contact: <sip:09711895361@Z.Z.Z.Z:40597>
  121.  
  122. To: <sip:09711895361@X.X.X.X>;tag=7a3af13f
  123.  
  124. From: <sip:09711895150@Y.Y.Y.Y>;tag=00E0F51008D6D4843B0E3E1E80F8
  125.  
  126. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  127.  
  128. CSeq: 20994 INVITE
  129.  
  130. Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
  131.  
  132. Content-Type: application/sdp
  133.  
  134. User-Agent: X-Lite release 1104o stamp 56125
  135.  
  136. Content-Length: 198
  137.  
  138. P-hint: forced rtp Z.Z.Z.Z
  139.  
  140. P-hint: nated fixed
  141.  
  142.  
  143.  
  144. v=0
  145.  
  146. o=- 4 2 IN IP4 X.X.X.X
  147.  
  148. s=CounterPath X-Lite 3.0
  149.  
  150. c=IN IP4 X.X.X.X
  151.  
  152. t=0 0
  153.  
  154. m=audio 60180 RTP/AVP 8 0 96
  155.  
  156. a=fmtp:96 0-15
  157.  
  158. a=rtpmap:96 telephone-event/8000
  159.  
  160. a=sendrecv
  161.  
  162. a=nortpproxy:yes
  163.  
  164. ACK sip:09711895361@Z.Z.Z.Z:40597 SIP/2.0
  165.  
  166. Via: SIP/2.0/UDP Y.Y.Y.Y:2149;branch=z9hG4bK00E0F51008D6D4843D5EC23085CB
  167.  
  168. Route: <sip:X.X.X.X;lr;nat=yes>
  169.  
  170. From: <sip:09711895150@Y.Y.Y.Y>;tag=00E0F51008D6D4843B0E3E1E80F8
  171.  
  172. To: <sip:09711895361@X.X.X.X>;tag=7a3af13f
  173.  
  174. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  175.  
  176. CSeq: 20994 ACK
  177.  
  178. Contact: <sip:09711895150@Y.Y.Y.Y:5060>
  179.  
  180. Max-Forwards: 70
  181.  
  182. Content-Length: 0
  183.  
  184.  
  185.  
  186. BYE sip:09711895361@Z.Z.Z.Z:40597 SIP/2.0
  187.  
  188. Via: SIP/2.0/UDP Y.Y.Y.Y:2149;branch=z9hG4bK00E0F51008D6D4843F3CB0C591D4
  189.  
  190. Route: <sip:X.X.X.X;lr;nat=yes>
  191.  
  192. From: <sip:09711895150@Y.Y.Y.Y>;tag=00E0F51008D6D4843B0E3E1E80F8
  193.  
  194. To: <sip:09711895361@X.X.X.X>;tag=7a3af13f
  195.  
  196. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  197.  
  198. CSeq: 20995 BYE
  199.  
  200. Contact: <sip:09711895150@Y.Y.Y.Y:5060>
  201.  
  202. Max-Forwards: 70
  203.  
  204. Reason: Q.850;cause=16;text="Normal call clearing"
  205.  
  206. Content-Length: 0
  207.  
  208.  
  209.  
  210. SIP/2.0 200 OK
  211.  
  212. Via: SIP/2.0/UDP Y.Y.Y.Y:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843F3CB0C591D4
  213.  
  214. Contact: <sip:09711895361@X.X.X.X>
  215.  
  216. To: <sip:09711895361@X.X.X.X>;tag=7a3af13f
  217.  
  218. From: <sip:09711895150@Y.Y.Y.Y>;tag=00E0F51008D6D4843B0E3E1E80F8
  219.  
  220. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  221.  
  222. CSeq: 20995 BYE
  223.  
  224. User-Agent: X-Lite release 1104o stamp 56125
  225.  
  226. Content-Length: 0
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233. ######SIP-FLOW KAMAILIO <---> CLIENT
  234.  
  235.  
  236. INVITE sip:09711895361@Y.Y.Y.Y SIP/2.0
  237.  
  238. Record-Route: <sip:Y.Y.Y.Y;lr=on;nat=yes>
  239.  
  240. Via: SIP/2.0/UDP Y.Y.Y.Y;branch=z9hG4bKf5d3.2601ebd4.0
  241.  
  242. Via: SIP/2.0/UDP X.X.X.X:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843B0E34E42C36
  243.  
  244. From: <sip:09711895150@X.X.X.X>;tag=00E0F51008D6D4843B0E3E1E80F8
  245.  
  246. To: <sip:09711895361@Y.Y.Y.Y>
  247.  
  248. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  249.  
  250. CSeq: 20994 INVITE
  251.  
  252. Contact: <sip:X.X.X.X:5060>
  253.  
  254. Allow-Events: refer
  255.  
  256. Max-Forwards: 69
  257.  
  258. Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, INFO, REFER, NOTIFY, SUBSCRIBE, UPDATE
  259.  
  260. Content-Type: application/sdp
  261.  
  262. Supported: 100rel, timer, replaces
  263.  
  264. User-Agent: TELES.iSWITCH
  265.  
  266. Content-Length: 325
  267.  
  268.  
  269.  
  270. v=0
  271.  
  272. o=- 379612009 0 IN IP4 Y.Y.Y.Y
  273.  
  274. s=session
  275.  
  276. t=0 0
  277.  
  278. m=audio 43140 RTP/AVP 18 18 18 18 8 0 96
  279.  
  280. c=IN IP4 Y.Y.Y.Y
  281.  
  282. a=rtpmap:18 G729/8000
  283.  
  284. a=rtpmap:18 G729A/8000
  285.  
  286. a=rtpmap:18 G729B/8000
  287.  
  288. a=rtpmap:18 G729/8000
  289.  
  290. a=rtpmap:8 PCMA/8000
  291.  
  292. a=rtpmap:0 PCMU/8000
  293.  
  294. a=sendrecv
  295.  
  296. a=rtpmap:96 telephone-event/8000
  297.  
  298. a=nortpproxy:yes
  299.  
  300. SIP/2.0 180 Ringing
  301.  
  302. Via: SIP/2.0/UDP Y.Y.Y.Y;branch=z9hG4bKf5d3.2601ebd4.0
  303.  
  304. Via: SIP/2.0/UDP X.X.X.X:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843B0E34E42C36
  305.  
  306. Record-Route: <sip:Y.Y.Y.Y;lr;nat=yes>
  307.  
  308. Contact: <sip:09711895361@Y.Y.Y.Y>
  309.  
  310. To: <sip:09711895361@Y.Y.Y.Y>;tag=7a3af13f
  311.  
  312. From: <sip:09711895150@X.X.X.X>;tag=00E0F51008D6D4843B0E3E1E80F8
  313.  
  314. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  315.  
  316. CSeq: 20994 INVITE
  317.  
  318. User-Agent: X-Lite release 1104o stamp 56125
  319.  
  320. Content-Length: 0
  321.  
  322.  
  323.  
  324. SIP/2.0 200 OK
  325.  
  326. Via: SIP/2.0/UDP Y.Y.Y.Y;branch=z9hG4bKf5d3.2601ebd4.0
  327.  
  328. Via: SIP/2.0/UDP X.X.X.X:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843B0E34E42C36
  329.  
  330. Record-Route: <sip:Y.Y.Y.Y;lr;nat=yes>
  331.  
  332. Contact: <sip:09711895361@Y.Y.Y.Y>
  333.  
  334. To: <sip:09711895361@Y.Y.Y.Y>;tag=7a3af13f
  335.  
  336. From: <sip:09711895150@X.X.X.X>;tag=00E0F51008D6D4843B0E3E1E80F8
  337.  
  338. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  339.  
  340. CSeq: 20994 INVITE
  341.  
  342. Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
  343.  
  344. Content-Type: application/sdp
  345.  
  346. User-Agent: X-Lite release 1104o stamp 56125
  347.  
  348. Content-Length: 184
  349.  
  350.  
  351.  
  352. v=0
  353.  
  354. o=- 4 2 IN IP4 172.16.10.146
  355.  
  356. s=CounterPath X-Lite 3.0
  357.  
  358. c=IN IP4 172.16.10.146
  359.  
  360. t=0 0
  361.  
  362. m=audio 65502 RTP/AVP 8 0 96
  363.  
  364. a=fmtp:96 0-15
  365.  
  366. a=rtpmap:96 telephone-event/8000
  367.  
  368. a=sendrecv
  369.  
  370. ACK sip:09711895361@84.253.172.33:40597 SIP/2.0
  371.  
  372. Via: SIP/2.0/UDP Y.Y.Y.Y;branch=0
  373.  
  374. Via: SIP/2.0/UDP X.X.X.X:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843D5EC23085CB
  375.  
  376. From: <sip:09711895150@X.X.X.X>;tag=00E0F51008D6D4843B0E3E1E80F8
  377.  
  378. To: <sip:09711895361@Y.Y.Y.Y>;tag=7a3af13f
  379.  
  380. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  381.  
  382. CSeq: 20994 ACK
  383.  
  384. Contact: <sip:09711895150@X.X.X.X:5060>
  385.  
  386. Max-Forwards: 69
  387.  
  388. Content-Length: 0
  389.  
  390.  
  391.  
  392. ....BYE sip:09711895361@84.253.172.33:40597 SIP/2.0
  393.  
  394. Via: SIP/2.0/UDP Y.Y.Y.Y;branch=z9hG4bK06d3.3104cee2.0
  395.  
  396. Via: SIP/2.0/UDP X.X.X.X:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843F3CB0C591D4
  397.  
  398. From: <sip:09711895150@X.X.X.X>;tag=00E0F51008D6D4843B0E3E1E80F8
  399.  
  400. To: <sip:09711895361@Y.Y.Y.Y>;tag=7a3af13f
  401.  
  402. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  403.  
  404. CSeq: 20995 BYE
  405.  
  406. Contact: <sip:09711895150@X.X.X.X:5060>
  407.  
  408. Max-Forwards: 69
  409.  
  410. Reason: Q.850;cause=16;text="Normal call clearing"
  411.  
  412. Content-Length: 0
  413.  
  414.  
  415.  
  416. SIP/2.0 200 OK
  417.  
  418. Via: SIP/2.0/UDP Y.Y.Y.Y;branch=z9hG4bK06d3.3104cee2.0
  419.  
  420. Via: SIP/2.0/UDP X.X.X.X:2149;rport=2149;branch=z9hG4bK00E0F51008D6D4843F3CB0C591D4
  421.  
  422. Contact: <sip:09711895361@Y.Y.Y.Y>
  423.  
  424. To: <sip:09711895361@Y.Y.Y.Y>;tag=7a3af13f
  425.  
  426. From: <sip:09711895150@X.X.X.X>;tag=00E0F51008D6D4843B0E3E1E80F8
  427.  
  428. Call-ID: 505980000c82-4dcc001b-52422d5f-2e9c5f80-181cf48@127.0.0.1
  429.  
  430. CSeq: 20995 BYE
  431.  
  432. User-Agent: X-Lite release 1104o stamp 56125
  433.  
  434. Content-Length: 0
  435.  
  436.  
  437.  
  438. ######SIP ROUTING LOGIC
  439.  
  440.  
  441. route[PSTN] {
  442. #!ifdef WITH_PSTN
  443. # check if PSTN GW IP is defined
  444. if(strempty($sel(cfg_get.pstn.gw_ip))) {
  445. xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
  446. return;
  447. }
  448.  
  449. # route to PSTN dialed numbers starting with '+' or '00'
  450. # (international format)
  451. # - update the condition to match your dialing rules for PSTN routing
  452. if(!($rU=~"^(\+|0|3)[1-9][0-9]{3,20}$"))
  453. return;
  454.  
  455. # only local users allowed to call
  456. if(from_uri!=myself) {
  457. route(INBOUND);
  458.  
  459.  
  460. if (!allow_trusted("$fd", "$proto")) {
  461. xlog("L_WARN","not allowed trusted $td\n");
  462. if (!proxy_authorize("$td", "subscriber")) {
  463. xlog("L_WARN","proxy authorize fails $td\n");
  464. proxy_challenge("$td", "0");
  465. exit;
  466. };
  467. }else{
  468. rewriteuri("sip:09711895361@Y.Y.Y.Y");
  469. xlog("L_WARN","rewrited host $dd\n");
  470. if(lookup("location")){
  471. $ru="sip:" + $rU + "@" + $od;
  472. xlog("L_WARN", "ru * 0 * ='$ru' \n");
  473. route(RELAY);
  474. return;
  475. # t_relay();
  476. };
  477. }
  478. }
  479. #!endif
  480.  
  481. return;
  482. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement