{"id":855,"date":"2026-04-15T12:43:03","date_gmt":"2026-04-15T04:43:03","guid":{"rendered":"https:\/\/www.liaoxinghui.com\/?p=855"},"modified":"2026-04-15T12:43:03","modified_gmt":"2026-04-15T04:43:03","slug":"freeswitch-sip-trunk-domain-mismatch-solution-tradeoff","status":"publish","type":"post","link":"https:\/\/www.liaoxinghui.com\/?p=855","title":{"rendered":"FreeSWITCH SIP\u4e2d\u7ee7\u6ce8\u518c403\uff1aFrom\/To\/Contact\u57df\u540d\u4e0d\u4e00\u81f4\u7684\u65b9\u6848\u53d6\u820d"},"content":{"rendered":"<h2>\u4e1a\u52a1\u573a\u666f<\/h2>\n<p>\u8fd0\u8425\u5546SIP\u4e2d\u7ee7\u6ce8\u518c\u5931\u8d25\u662f\u4e2a\u9ad8\u9891\u95ee\u9898\u3002FreeSWITCH\u8fde\u4e0a\u8fd0\u8425\u5546\u7684\u63a5\u5165\u70b9\uff0c<code>sofia status profile external<\/code> \u663e\u793a <code>REG_FAIL<\/code>\uff0c\u8fd0\u8425\u5546\u8fd4\u56de <code>403 Forbidden<\/code>\u3002<\/p>\n<p>\u5927\u591a\u6570\u4eba\u7684\u6392\u67e5\u8def\u5f84\u662f\uff1a\u5bc6\u7801\u5bf9\u4e86\u6ca1\uff1fIP\u767d\u540d\u5355\u52a0\u4e86\u6ca1\uff1fUser-Agent\u8981\u4e0d\u8981\u6539\uff1f\u6539\u4e86\u4e00\u5708\u8fd8\u662f403\u3002<\/p>\n<p>\u6293\u4e2a\u5305\u770b\u770b\uff1a<\/p>\n<pre><code>REGISTER sip:trunk.operator.com SIP\/2.0\nFrom: &lt;sip:your_number@your_domain.com&gt;\nTo: &lt;sip:your_number@your_domain.com&gt;\nContact: &lt;sip:your_number@172.16.1.100:5060&gt;<\/code><\/pre>\n<p>\u95ee\u9898\u5f80\u5f80\u4e0d\u5728\u8ba4\u8bc1\u73af\u8282\u2014\u2014\u8fd0\u8425\u5546\u6821\u9a8c\u7684\u662f SIP \u5934\u57df\u91cc\u7684\u57df\u540d\u683c\u5f0f\uff0c\u800c\u4e0d\u662f\u4f60\u7684\u5bc6\u7801\u3002From\/To \u5934\u57df\u91cc\u7684 <code>@your_domain.com<\/code> \u548c Contact \u5934\u57df\u91cc\u7684 <code>172.16.1.100<\/code> \u4e0d\u5339\u914d\u8fd0\u8425\u5546\u7684\u8981\u6c42\uff0c\u6ce8\u518c\u8bf7\u6c42\u5728\u8ba4\u8bc1\u4e4b\u524d\u5c31\u88ab\u62d2\u7edd\u4e86\u3002<\/p>\n<blockquote>\n<p><strong>From\/To \u5934\u57df<\/strong>\uff08SIP\u8eab\u4efd\u6807\u8bc6\uff09\uff1a\u683c\u5f0f <code>sip:\u7528\u6237\u540d@\u57df\u540d<\/code>\uff0c\u8fd0\u8425\u5546\u7528\u5b83\u5224\u65ad\u8bf7\u6c42\u8005\u8eab\u4efd\u662f\u5426\u5728\u6388\u6743\u5217\u8868\u91cc\u3002<\/p>\n<p><strong>Contact \u5934\u57df<\/strong>\uff08SIP\u4f4d\u7f6e\u6807\u8bc6\uff09\uff1a\u683c\u5f0f <code>sip:\u7528\u6237\u540d@\u4e3b\u673a\u5730\u5740:\u7aef\u53e3<\/code>\uff0c\u8fd0\u8425\u5546\u7528\u5b83\u51b3\u5b9a\u628a\u547c\u53eb\u8def\u7531\u5230\u54ea\u91cc\u3002<\/p>\n<\/blockquote>\n<h2>\u6280\u672f\u5224\u65ad\uff1a\u4e3a\u4ec0\u4e48\u662f\u57df\u540d\u683c\u5f0f\u95ee\u9898<\/h2>\n<p>\u533a\u5206\u300c\u57df\u540d\u683c\u5f0f\u6821\u9a8c\u5931\u8d25\u300d\u548c\u300c\u8ba4\u8bc1\u5931\u8d25\u300d\u6709\u4e2a\u7b80\u5355\u65b9\u6cd5\uff1a\u770b 403 \u54cd\u5e94\u7684 Reason \u5934\u57df\u3002<\/p>\n<p>\u8fd0\u8425\u5546\u8fd4\u56de\u7684 403 \u5982\u679c\u5e26\u6709 <code>Reason: Q.850;cause=88;text=&quot;Prefix or Number Unknown&quot;<\/code> \u6216 <code>Reason: SIP;cause=403;text=&quot;Domain Mismatch&quot;<\/code> \u8fd9\u7c7b\u63cf\u8ff0\uff0c\u57fa\u672c\u53ef\u4ee5\u786e\u5b9a\u662f\u57df\u540d\u683c\u5f0f\u95ee\u9898\uff0c\u4e0d\u662f\u5bc6\u7801\u95ee\u9898\u3002<\/p>\n<p>\u53e6\u4e00\u4e2a\u5224\u65ad\u4f9d\u636e\uff1a\u5173\u6389 <code>auth-calls<\/code> \u53c2\u6570\u540e\u5982\u679c\u8fd8\u662f 403\uff0c\u8bf4\u660e\u6839\u672c\u6ca1\u8d70\u5230\u8ba4\u8bc1\u6d41\u7a0b\u3002\u8ba4\u8bc1\u5931\u8d25\u7684 403 \u5728\u5173\u95ed\u8ba4\u8bc1\u540e\u81f3\u5c11\u80fd\u901a\u8fc7\u6821\u9a8c\u2014\u2014\u867d\u7136\u540e\u7eed\u547c\u53eb\u53ef\u80fd\u4f1a\u6709\u522b\u7684\u95ee\u9898\uff0c\u4f46\u4e0d\u4f1a\u5728\u6ce8\u518c\u9636\u6bb5\u5c31\u88ab\u6253\u56de\u3002<\/p>\n<p>\u6293\u5305\u786e\u8ba4\u7684\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"lang-bash language-bash bash\">tcpdump -i any -n port 5060 -v | grep -E &quot;(From:|To:|Contact:|REGISTER|SIP\/2.0 403)&quot;<\/code><\/pre>\n<h2>\u65b9\u6848\u53d6\u820d<\/h2>\n<p>\u89e3\u51b3 From\/To\/Contact \u57df\u540d\u4e0d\u4e00\u81f4\u7684\u95ee\u9898\uff0c\u4e3b\u6d41\u65b9\u6848\u6709\u4e09\u4e2a\u3002\u6211\u5148\u8bf4\u7ed3\u8bba\uff0c\u518d\u5c55\u5f00\u89e3\u91ca\u4e3a\u4ec0\u4e48\u3002<\/p>\n<p><strong>\u7ed3\u8bba\uff1a\u5355\u4e2d\u7ee7\u9009\u65b9\u6848\u4e00\uff0c\u591a\u4e2d\u7ee7\u9009\u65b9\u6848\u4e8c\uff0c\u65b9\u6848\u4e09\u80fd\u4e0d\u78b0\u5c31\u4e0d\u78b0\u3002<\/strong><\/p>\n<h3>\u65b9\u6848\u4e00\uff1aforce-register-domain\uff08Profile\u7ea7\u5f3a\u5236\u57df\u540d\uff09<\/h3>\n<p>\u5728 Sofia Profile \u914d\u7f6e\u91cc\u52a0\u4e00\u884c\uff0c\u8ba9\u6240\u6709\u53d1\u51fa\u53bb\u7684 Register \u8bf7\u6c42\u4f7f\u7528\u7edf\u4e00\u7684 From\/To \u57df\u540d\uff1a<\/p>\n<pre><code class=\"lang-xml language-xml xml\">&lt;param name=&quot;force-register-domain&quot; value=&quot;operator_trunk_domain.com&quot;\/&gt;<\/code><\/pre>\n<p>\u8fd9\u4e2a\u65b9\u6848\u7684\u4f18\u70b9\u662f<strong>\u914d\u7f6e\u6781\u7b80\uff0c\u4e00\u6b21\u751f\u6548<\/strong>\u3002\u6539\u4e00\u884c\u914d\u7f6e\uff0c\u6240\u6709\u7ecf\u8fc7\u8fd9\u4e2a Profile \u7684\u6ce8\u518c\u8bf7\u6c42\u90fd\u7edf\u4e00\u7528\u8fd9\u4e2a\u57df\u540d\uff0c\u4e0d\u9700\u8981\u9010\u4e2a Gateway \u53bb\u8c03\u3002<\/p>\n<p>\u7f3a\u70b9\u662f<strong>\u53ea\u80fd\u6307\u5b9a\u4e00\u4e2a\u57df\u540d<\/strong>\u3002\u5982\u679c\u4f60\u53ea\u6709\u4e00\u4e2a\u8fd0\u8425\u5546\u4e2d\u7ee7\uff0c\u8fd9\u4e2a\u65b9\u6848\u5b8c\u7f8e\u3002\u5982\u679c\u6709\u591a\u4e2a\u4e2d\u7ee7\u3001\u6bcf\u4e2a\u8981\u7528\u4e0d\u540c\u7684\u57df\u540d\uff0c\u8fd9\u4e2a\u65b9\u6848\u5c31\u4e0d\u591f\u7528\u4e86\u3002<\/p>\n<p>\u9002\u7528\u573a\u666f\uff1a\u5bf9\u63a5\u5355\u4e00\u8fd0\u8425\u5546SIP\u4e2d\u7ee7\uff0c\u6216\u8005\u6240\u6709\u4e2d\u7ee7\u90fd\u8981\u6c42\u76f8\u540c\u7684 From\/To \u57df\u540d\u683c\u5f0f\u3002<\/p>\n<h3>\u65b9\u6848\u4e8c\uff1aGateway\u7ea7\u72ec\u7acb\u914d\u7f6e\uff08\u63a8\u8350\u591a\u4e2d\u7ee7\u573a\u666f\uff09<\/h3>\n<p>\u5728 Gateway \u914d\u7f6e\u91cc\u5355\u72ec\u8bbe\u7f6e <code>register-proxy<\/code> \u548c <code>contact-params<\/code>\uff1a<\/p>\n<pre><code class=\"lang-xml language-xml xml\">&lt;gateway name=&quot;operator_trunk&quot;&gt;\n  &lt;param name=&quot;username&quot; value=&quot;your_number&quot;\/&gt;\n  &lt;param name=&quot;realm&quot; value=&quot;operator_trunk_domain.com&quot;\/&gt;\n  &lt;param name=&quot;password&quot; value=&quot;your_password&quot;\/&gt;\n  &lt;param name=&quot;proxy&quot; value=&quot;trunk.operator.com&quot;\/&gt;\n  &lt;param name=&quot;register-proxy&quot; value=&quot;trunk.operator.com&quot;\/&gt;\n  &lt;param name=&quot;contact-params&quot; value=&quot;domain_name=operator_trunk_domain.com&quot;\/&gt;\n&lt;\/gateway&gt;<\/code><\/pre>\n<p>\u8fd9\u4e2a\u65b9\u6848\u7684\u4f18\u70b9\u662f<strong>\u7075\u6d3b\u6027\u9ad8\uff0c\u6bcf\u4e2a Gateway \u72ec\u7acb\u914d\u7f6e<\/strong>\uff0c\u60f3\u52a0\u65b0\u4e2d\u7ee7\u76f4\u63a5\u65b0\u5efa Gateway\uff0c\u4e0d\u5f71\u54cd\u73b0\u6709\u7684\u3002\u7f3a\u70b9\u662f\u914d\u7f6e\u9879\u591a\uff0c\u9700\u8981\u641e\u6e05\u695a <code>realm<\/code>\u3001<code>proxy<\/code>\u3001<code>register-proxy<\/code> \u5404\u81ea\u7684\u7528\u9014\u2014\u2014\u7528\u9519\u53c2\u6570\u7684\u8bdd\u6ce8\u518c\u8fd8\u662f\u5931\u8d25\u3002<\/p>\n<blockquote>\n<p><strong>realm<\/strong>\uff1a\u8ba4\u8bc1 realm\uff0c\u901a\u5e38\u4e0e\u8fd0\u8425\u5546\u8981\u6c42\u7684\u57df\u540d\u4e00\u81f4\u3002<\/p>\n<p><strong>proxy<\/strong>\uff1aSIP Proxy \u5730\u5740\uff0c\u6ce8\u518c\u8bf7\u6c42\u53d1\u5f80\u7684\u76ee\u6807\u3002<\/p>\n<p><strong>register-proxy<\/strong>\uff1a\u6ce8\u518c\u4ee3\u7406\uff0c\u5f3a\u5236\u6307\u5b9a\u6ce8\u518c\u8bf7\u6c42\u7684\u8def\u7531\u5730\u5740\u3002\u6709\u4e9b\u8fd0\u8425\u5546\u8981\u6c42 proxy \u548c register-proxy \u8bbe\u4e3a\u540c\u4e00\u4e2a\u503c\u3002<\/p>\n<\/blockquote>\n<p>\u9002\u7528\u573a\u666f\uff1a\u5bf9\u63a5\u591a\u4e2a\u8fd0\u8425\u5546\u4e2d\u7ee7\uff0c\u6216\u8005\u540c\u4e00\u4e2a\u8fd0\u8425\u5546\u4f46\u9700\u8981\u4f7f\u7528\u4e0d\u540c\u57df\u540d\u683c\u5f0f\u3002<\/p>\n<h3>\u65b9\u6848\u4e09\uff1aaccept-blind-reg\uff08\u98ce\u9669\u6700\u9ad8\u7684\u65b9\u6848\uff09<\/h3>\n<pre><code class=\"lang-xml language-xml xml\">&lt;param name=&quot;outbound-proxy&quot; value=&quot;sip:trunk.operator.com&quot;\/&gt;\n&lt;param name=&quot;accept-blind-reg&quot; value=&quot;true&quot;\/&gt;<\/code><\/pre>\n<p><code>accept-blind-reg<\/code> \u7684\u4f5c\u7528\u662f<strong>\u8df3\u8fc7\u57df\u540d\u6821\u9a8c\uff0c\u63a5\u53d7\u4efb\u4f55\u683c\u5f0f\u7684 Register \u8bf7\u6c42<\/strong>\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u4e0d\u63a8\u8350\uff1a<\/p>\n<ol>\n<li><strong>\u5b89\u5168\u98ce\u9669\u6781\u9ad8<\/strong>\u3002\u4efb\u4f55\u4eba\u90fd\u80fd\u7528\u4efb\u610f\u57df\u540d\u5411\u4f60\u53d1\u8d77 Register \u8bf7\u6c42\uff0c\u4f60\u7684\u7cfb\u7edf\u6765\u8005\u4e0d\u62d2\u3002<\/li>\n<li><strong>\u6cbb\u6807\u4e0d\u6cbb\u672c<\/strong>\u3002\u8fd0\u8425\u5546\u4fa7\u8fd8\u662f\u4f1a\u6821\u9a8c\u4f60\u7684\u57df\u540d\u683c\u5f0f\uff0c\u4f60\u5173\u6389\u672c\u5730\u6821\u9a8c\u4e0d\u7b49\u4e8e\u8fd0\u8425\u5546\u653e\u8fc7\u4f60\u3002<\/li>\n<li><strong>\u589e\u52a0\u6392\u67e5\u96be\u5ea6<\/strong>\u3002\u51fa\u4e86\u95ee\u9898\u662f\u672c\u5730\u95ee\u9898\u8fd8\u662f\u8fd0\u8425\u5546\u95ee\u9898\u66f4\u96be\u5b9a\u4f4d\u3002<\/li>\n<\/ol>\n<p>\u8fd9\u4e2a\u65b9\u6848\u53ea\u9002\u5408\u5728<strong>\u6392\u67e5\u9636\u6bb5\u4e34\u65f6\u5f00\u542f<\/strong>\uff0c\u786e\u8ba4\u5230\u5e95\u662f\u54ea\u4e2a\u73af\u8282\u51fa\u95ee\u9898\u3002\u4e00\u65e6\u5b9a\u4f4d\u5230\u95ee\u9898\uff0c\u7acb\u5373\u5173\u95ed\u3002\u751f\u4ea7\u73af\u5883\u7edd\u5bf9\u4e0d\u80fd\u5f00\u3002<\/p>\n<h3>\u65b9\u6848\u53d6\u820d\u7684\u5224\u65ad\u903b\u8f91<\/h3>\n<pre><code>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502  \u4f60\u9700\u8981\u5bf9\u63a5\u51e0\u4e2a\u8fd0\u8425\u5546\u4e2d\u7ee7\uff1f                   \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                    \u2502\n         \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n         \u25bc                   \u25bc\n     \u53ea\u6709\u4e00\u4e2a           \u591a\u4e2a\uff0c\u6216\u8005\n         \u2502            \u57df\u540d\u683c\u5f0f\u4e0d\u540c\n         \u25bc                   \u25bc\n   \u65b9\u6848\u4e00\uff1aforce-     \u65b9\u6848\u4e8c\uff1aGateway\n   register-domain   \u7ea7\u72ec\u7acb\u914d\u7f6e\n         \u2502                   \u2502\n         \u2514\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n             \u25bc\n      \u9a8c\u8bc1\u6ce8\u518c\u662f\u5426\u6210\u529f\n             \u2502\n      \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n      \u25bc             \u25bc\n   \u6210\u529f           \u5931\u8d25&rarr;\u6293\u5305\u770bReason\u63cf\u8ff0\n                              \u2502\n               \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n               \u25bc                               \u25bc\n          \u57df\u540d\u95ee\u9898               \u534f\u8bae\u95ee\u9898\uff08UDP\/TCP\uff09\n          \u7ee7\u7eed\u8c03\u6574\u57df\u540d            \u6539 transport \u53c2\u6570<\/code><\/pre>\n<h2>\u5b9e\u73b0\u6b65\u9aa4<\/h2>\n<h3>\u7b2c\u4e00\u6b65\uff1a\u786e\u8ba4\u5f53\u524d\u914d\u7f6e\u548c\u6ce8\u518c\u72b6\u6001<\/h3>\n<pre><code class=\"lang-bash language-bash bash\"># \u67e5\u770b Profile \u7ea7\u522b\u7684\u6ce8\u518c\u72b6\u6001\nsofia status profile external\n\n# \u67e5\u770b\u7279\u5b9a Gateway \u7684\u8be6\u7ec6\u72b6\u6001\nsofia status gateway operator_trunk\n\n# \u67e5\u770b\u5f53\u524d\u6709\u54ea\u4e9b\u5df2\u6ce8\u518c\u7684 Contact\nsofia status profile external reg<\/code><\/pre>\n<h3>\u7b2c\u4e8c\u6b65\uff1a\u6e05\u9664\u65e7\u6ce8\u518c\u8bb0\u5f55<\/h3>\n<p>\u4fee\u6539\u57df\u540d\u914d\u7f6e\u540e\uff0c\u5fc5\u987b\u6e05\u9664 FreeSWITCH \u7f13\u5b58\u7684\u6ce8\u518c\u4fe1\u606f\uff0c\u5426\u5219\u65e7\u7684 Contact \u8bb0\u5f55\u4f1a\u6b8b\u7559\uff0c\u8fd0\u8425\u5546\u90a3\u8fb9\u7684\u65e7\u6ce8\u518c\u4e5f\u4e0d\u4f1a\u81ea\u52a8\u8fc7\u671f\u3002<\/p>\n<pre><code class=\"lang-bash language-bash bash\"># \u5728 fs_cli \u91cc\u6267\u884c\uff0c\u5f3a\u5236\u6e05\u9664\u6307\u5b9a Gateway \u7684\u6ce8\u518c\nsofia profile external kill-register operator_trunk\n\n# \u6216\u8005\u7528 unregister \u547d\u4ee4\nsofia unregister operator_trunk trunk.operator.com<\/code><\/pre>\n<h3>\u7b2c\u4e09\u6b65\uff1a\u4fee\u6539\u914d\u7f6e<\/h3>\n<p><strong>\u65b9\u6848\u4e00\u7684\u914d\u7f6e<\/strong>\uff08\u5728 <code>sip_profiles\/external.xml<\/code> \u91cc\uff09\uff1a<\/p>\n<pre><code class=\"lang-xml language-xml xml\">&lt;!-- \u8fd0\u8425\u5546\u8981\u6c42 From\/To \u4f7f\u7528 operator_trunk_domain.com --&gt;\n&lt;param name=&quot;force-register-domain&quot; value=&quot;operator_trunk_domain.com&quot;\/&gt;\n&lt;param name=&quot;force-register-db-domain&quot; value=&quot;operator_trunk_domain.com&quot;\/&gt;<\/code><\/pre>\n<blockquote>\n<p><code>force-register-db-domain<\/code> \u786e\u4fdd FreeSWITCH \u5185\u90e8\u6570\u636e\u5e93\u4e5f\u4f7f\u7528\u8fd9\u4e2a\u57df\u540d\u5b58\u50a8\u6ce8\u518c\u4fe1\u606f\uff0c\u907f\u514d Profile \u5185\u67e5\u8be2\u4e0d\u5230\u521a\u6ce8\u518c\u4e0a\u7684 Contact\u3002<\/p>\n<\/blockquote>\n<p><strong>\u65b9\u6848\u4e8c\u7684\u524d\u63d0<\/strong>\uff1a\u786e\u4fdd Gateway \u914d\u7f6e\u6587\u4ef6\u5b58\u5728\uff0c\u901a\u5e38\u5728 <code>sip_profiles\/gateways\/operator_trunk.xml<\/code>\u3002\u5982\u679c\u4e0d\u5b58\u5728\uff0c\u53c2\u8003\u4e0a\u9762\u65b9\u6848\u4e8c\u7684\u914d\u7f6e\u5185\u5bb9\u521b\u5efa\u3002<\/p>\n<h3>\u7b2c\u56db\u6b65\uff1a\u91cd\u542f Profile \u8ba9\u914d\u7f6e\u751f\u6548<\/h3>\n<pre><code class=\"lang-bash language-bash bash\">sofia profile external restart<\/code><\/pre>\n<p>\u91cd\u542f\u540e\u89c2\u5bdf\u51e0\u79d2\u949f\uff0c\u7136\u540e\u7528 <code>sofia status gateway operator_trunk<\/code> \u68c0\u67e5\u72b6\u6001\u3002<\/p>\n<h3>\u7b2c\u4e94\u6b65\uff1a\u9a8c\u8bc1<\/h3>\n<p>\u6ce8\u518c\u6210\u529f\u7684\u6807\u5fd7\u662f\u72b6\u6001\u663e\u793a <code>REGED<\/code>\uff1a<\/p>\n<pre><code>================================================================================\nName                State        Port    Secure  Username    Realm\n================================================================================\noperator_trunk      REGED        5060    No     your_number  operator_trunk_domain.com\n================================================================================<\/code><\/pre>\n<p>\u5982\u679c\u8fd8\u662f <code>REG_FAIL<\/code>\uff0c\u6293\u5305\u5206\u6790\u65b0\u7684 403 \u54cd\u5e94\u91cc\u7684 Reason \u63cf\u8ff0\uff1a<\/p>\n<pre><code class=\"lang-bash language-bash bash\"># \u6355\u83b7 SIP \u6d41\u91cf\u5230\u6587\u4ef6\ntcpdump -i any -n host trunk.operator.com and port 5060 -w \/tmp\/sip_capture.pcap\n\n# \u7528 sngrep \u67e5\u770b\uff08\u5982\u679c\u5df2\u5b89\u88c5\uff09\nsngrep -I \/tmp\/sip_capture.pcap\n\n# \u6216\u8005\u7528 tshark \u63d0\u53d6\u5173\u952e\u5934\u57df\ntshark -r \/tmp\/sip_capture.pcap -Y &quot;sip&quot; -T fields -e sip.msg_hdr | grep -E &quot;(From|To|Contact|Reason)&quot;<\/code><\/pre>\n<h2>\u8fb9\u754c\u6761\u4ef6\u4e0e\u98ce\u9669\u70b9<\/h2>\n<h3>NAT\/SBC \u573a\u666f<\/h3>\n<p>\u5982\u679c FreeSWITCH \u524d\u9762\u6709 SBC\uff08Session Border Controller\uff09\u6216 NAT \u8bbe\u5907\uff0cContact \u5934\u57df\u91cc\u7684\u5730\u5740\u5fc5\u987b\u662f<strong>\u516c\u7f51\u53ef\u8fbe\u7684<\/strong>\u3002\u8fd0\u8425\u5546\u770b\u5230\u7684 Contact \u5fc5\u987b\u80fd\u8def\u7531\u56de\u6765\uff0c\u5426\u5219\u6ce8\u518c\u6210\u529f\u4e5f\u6ca1\u7528\u2014\u2014\u547c\u5165\u7684 INVITE \u9001\u4e0d\u5230\u4f60\u7684 FreeSWITCH\u3002<\/p>\n<p>\u8fd9\u79cd\u60c5\u51b5\u4e0b\u9700\u8981\u989d\u5916\u914d\u7f6e\uff1a<\/p>\n<pre><code class=\"lang-xml language-xml xml\">&lt;param name=&quot;NDLB-force-rport&quot; value=&quot;true&quot;\/&gt;\n&lt;param name=&quot;local-network-acl&quot; value=&quot;nat.auto&quot;\/&gt;<\/code><\/pre>\n<h3>\u591a\u57df\u540d\u6ce8\u518c\u7684\u5751<\/h3>\n<p>\u7528 <code>force-register-domain<\/code> \u65f6\u6709\u4e2a\u9690\u6027\u98ce\u9669\uff1a\u5982\u679c\u540c\u4e00\u4e2a Profile \u4e0b\u6709\u591a\u4e2a Gateway\uff0c\u5176\u4e2d\u4e00\u4e2a\u8981\u6c42 <code>your_number@operator_a.com<\/code>\uff0c\u53e6\u4e00\u4e2a\u8981\u6c42 <code>your_number@operator_b.com<\/code>\uff0c\u65b9\u6848\u4e00\u4f1a\u8ba9\u4f60\u4e8c\u9009\u4e00\uff0c\u6ca1\u529e\u6cd5\u540c\u65f6\u6ee1\u8db3\u3002<\/p>\n<p>\u8fd9\u65f6\u5019\u5fc5\u987b\u5207\u5230\u65b9\u6848\u4e8c\uff0c\u7ed9\u6bcf\u4e2a Gateway \u5355\u72ec\u914d\u7f6e\u57df\u540d\u3002<\/p>\n<h3>\u8fd0\u8425\u5546\u6539\u4e86\u57df\u540d\u89c4\u5219\u600e\u4e48\u529e<\/h3>\n<p>\u8fd0\u8425\u5546\u5076\u5c14\u4f1a\u8c03\u6574\u57df\u540d\u6821\u9a8c\u89c4\u5219\u2014\u2014\u6bd4\u5982\u4ece\u8981\u6c42\u7cbe\u786e\u5339\u914d\u6539\u4e3a\u652f\u6301\u901a\u914d\u7b26\uff0c\u6216\u8005\u53cd\u8fc7\u6765\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4f60\u8fd9\u8fb9\u4e5f\u9700\u8981\u8ddf\u7740\u6539\u3002\u5efa\u8bae\u5728\u914d\u7f6e\u91cc\u52a0\u6ce8\u91ca\uff0c\u8bb0\u5f55\u5f53\u521d\u4e3a\u4ec0\u4e48\u9009\u4e86\u8fd9\u4e2a\u57df\u540d\u683c\u5f0f\uff0c\u65b9\u4fbf\u540e\u7eed\u6392\u67e5\uff1a<\/p>\n<pre><code class=\"lang-xml language-xml xml\">&lt;!-- 2024-01 \u5bf9\u63a5\u65f6\u8fd0\u8425\u5546\u8981\u6c42 From\/To \u4f7f\u7528 operator_trunk_domain.com --&gt;\n&lt;!-- \u8054\u7cfb\u4eba\uff1a\u8fd0\u8425\u5546\u6280\u672f\u652f\u6301\u8001\u738b --&gt;\n&lt;param name=&quot;force-register-domain&quot; value=&quot;operator_trunk_domain.com&quot;\/&gt;<\/code><\/pre>\n<h2>\u4e0a\u7ebf\u540e\u8bc4\u4f30<\/h2>\n<p>\u914d\u7f6e\u751f\u6548\u540e\u9700\u8981\u89c2\u5bdf\u4e09\u4e2a\u7ef4\u5ea6\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u6ce8\u518c\u7a33\u5b9a\u6027<\/strong>\uff1a<code>sofia status profile external<\/code> \u8fde\u7eed\u51e0\u5c0f\u65f6\u663e\u793a <code>REGED<\/code>\uff0c\u6ca1\u6709\u53cd\u590d\u8df3 <code>REG_FAIL<\/code>\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u547c\u5165\u547c\u51fa\u6210\u529f\u7387<\/strong>\uff1a\u5b9e\u9645\u62e8\u6d4b\u51e0\u901a\u7535\u8bdd\uff0c\u786e\u8ba4\u4e3b\u88ab\u53eb\u90fd\u80fd\u5efa\u7acb\u901a\u8bdd\u3002\u5982\u679c\u6ce8\u518c\u6210\u529f\u4f46\u547c\u53eb\u5931\u8d25\uff0c\u95ee\u9898\u53ef\u80fd\u5728\u522b\u5904\u2014\u2014\u6bd4\u5982 DTMF \u683c\u5f0f\u3001\u7f16\u89e3\u7801\u534f\u5546\u3001\u6216\u8005 SIP URI \u683c\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u65e5\u5fd7\u544a\u8b66<\/strong>\uff1a\u68c0\u67e5 <code>\/var\/log\/freeswitch\/freeswitch.log<\/code>\uff0c\u8fc7\u6ee4\u5173\u952e\u8bcd <code>REG_FAIL<\/code>\u3001<code>403<\/code>\u3001<code>auth<\/code> \u786e\u8ba4\u6ca1\u6709\u5f02\u5e38\u3002<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"lang-bash language-bash bash\"># \u5b9e\u65f6\u67e5\u770b\u6ce8\u518c\u76f8\u5173\u65e5\u5fd7\ntail -f \/var\/log\/freeswitch\/freeswitch.log | grep -E &quot;(REGISTER|REGED|REG_FAIL|403)&quot;<\/code><\/pre>\n<p>\u6574\u4e2a\u6392\u67e5\u548c\u4fee\u590d\u8fc7\u7a0b\u7684\u6838\u5fc3\u903b\u8f91\u662f\uff1a<strong>\u5148\u786e\u8ba4\u662f\u57df\u540d\u683c\u5f0f\u95ee\u9898\u8fd8\u662f\u8ba4\u8bc1\u95ee\u9898\uff0c\u518d\u6839\u636e\u4e2d\u7ee7\u6570\u91cf\u9009\u62e9\u65b9\u6848\u4e00\u6216\u65b9\u6848\u4e8c\uff0c\u6700\u540e\u786e\u4fdd\u65e7\u6ce8\u518c\u8bb0\u5f55\u88ab\u6e05\u9664<\/strong>\u3002\u65b9\u6848\u4e09\u6c38\u8fdc\u7559\u4f5c\u6392\u67e5\u9636\u6bb5\u7684\u4e34\u65f6\u5de5\u5177\uff0c\u751f\u4ea7\u73af\u5883\u4e0d\u542f\u7528\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>freeswitch SIP\u4e2d\u7ee7\u6ce8\u518c\u5934\u5bfc\u81f4\u7684\u9a8c\u8bc1\uff0c\u8fd4\u56de403\u4e0d\u4ee3\u8868\u5bc6\u7801\u9519\u4e86\uff0c\u95ee\u9898\u5f80\u5f80\u4e0d\u5728\u8ba4\u8bc1\u73af\u8282\u2014\u2014\u8fd0\u8425\u5546\u6821\u9a8c\u7684\u662f SIP \u5934\u57df\u91cc\u7684\u57df\u540d\u683c\u5f0f\uff0c\u800c\u4e0d\u662f\u4f60\u7684\u5bc6\u7801\u3002From\/To \u5934\u57df\u91cc\u7684 <code>@your_domain.com<\/code> \u548c Contact \u5934\u57df\u91cc\u7684 <code>172.16.1.100<\/code> \u4e0d\u5339\u914d\u8fd0\u8425\u5546\u7684\u8981\u6c42\uff0c\u6ce8\u518c\u8bf7\u6c42\u5728\u8ba4\u8bc1\u4e4b\u524d\u5c31\u88ab\u62d2\u7edd\u4e86\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,236,439],"tags":[13,15,763,514,301,861],"class_list":{"0":"post-855","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-freeswitch","7":"category-voip","8":"category-439","9":"tag-freeswitch","10":"tag-sip","12":"tag-voip","13":"tag-301","14":"tag-861"},"views":25,"_links":{"self":[{"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=\/wp\/v2\/posts\/855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=855"}],"version-history":[{"count":1,"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=\/wp\/v2\/posts\/855\/revisions"}],"predecessor-version":[{"id":862,"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=\/wp\/v2\/posts\/855\/revisions\/862"}],"wp:attachment":[{"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.liaoxinghui.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}