Q: 外線撥入 SIP Trunk 後無法接通,出現訊息

    chan_sip.c: No compatible codecs, not accepting this offer

    A:這是 codec 不相容造成,必須修改 SIP Trunk 的 codec。要如何找出對方系統可接受的 codec,依照下述方法:

    1. 開啟 sip set debug

    2. 重製外線撥入的錯誤,並擷取如下的 log

    INVITE sip:07010178814@106.104.139.77:5060 SIP/2.0
    Via: SIP/2.0/UDP 202.133.231.17:5060;rport;branch=z9hG4bK+2ba826d2cb9c28f55649158b2e42156c1+sip+1+a9d2c847
    From: <sip:0975166435@chiefcall.com.tw>;tag=202.133.231.17+1+98d91835+cbefed37
    To: <sip:07010178814@chiefcall.com.tw>
    CSeq: 623980780 INVITE
    Expires: 180
    Content-Length: 175
    Call-Info: <sip:202.133.231.17:5060>;method="NOTIFY;Event=telephone-event;Duration=2000"
    Supported: resource-priority,siprec, 100rel
    Contact: <sip:91a18931544b6920a8fa48f3fd1e7790@202.133.231.17:5060>
    Content-Type: application/sdp
    Allow-Events: message-summary, refer, dialog, line-seize, presence, call-info, as-feature-event, calling-name
    Call-ID: 0gQAAC8WAAACBAAALxYAAAPNgJ3t7scBqLgDdG2c1DM9/Dzz/Jtbhb8ykdqcuk3o@202.133.231.17
    Organization: Metaswitch Networks
    Max-Forwards: 69
    Accept: application/sdp, application/dtmf-relay
    
    v=0
    o=- 51082140073993 51082140073993 IN IP4 202.133.231.17
    s=-
    c=IN IP4 202.133.231.17
    t=0 0
    m=audio 40866 RTP/AVP 8 101      <=== 可相容的 codec 
    a=rtpmap:101 telephone-event/8000    
    a=ptime:20
    <------------->
    --- (16 headers 8 lines) ---
    Sending to 202.133.231.17:5060 (NAT)
    

    Codec 的代號對應表

    3 : GSM
    97 : iLBC
    8 : PCMA
    0 : PCMU
    18 : G729

    Q: 外線 SIP Trunk 撥入後進入 Follow Me 轉到外部的手機號碼,手機接起會沒有聽到聲音

    A: 如果 Asterisk 放在 LAN 端,先檢查 sip_nat.conf 的外部 IP 是否正確,確認沒問題,問題一樣發生時,步驟如下:

    FreePBX > Tools > Asterisk SIP Settings

    在 Other SIP Setting 加上

    progressinband = yes
    

     

    Q: 如何避免 CDR 檔案 Master.csv 持續增大

    A:可以使用 logrotate 服務或者使用以下 SHELL

    asterisk-cdr-rollover.sh:

    reference to undefined name 'syntax' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)

    Q: 如何找出 xxx.so 模組的相依性套件

    A:編譯 asterisk 時,執行 make menuselect ,移到該模組項目,左下角會顯示相關資訊,更多資訊參閱 https://wiki.asterisk.org/wiki/displ...Support+States

    Q: 設定 sendmail

    A:註: 此法尚未有實作

    Edit /etc/aliases file  and add a “root: username_to_forward_to” to forward all ‘root’ messages to your personal email address.  Put in the full email address if it is not on the asterisk system itself.
    Then run 

    /usr/bin/newaliases

    to restart the service.

    If emails are not received you must set up masquerading in sendmail.  These still may be rejected if the email server requires the source of the email to also resolve to the same DNS that sendmail is masquerading as.
    To enable this, add the following lines to the /etc/mail/sendmail.mc file:

    MASQUERADE_AS(domain.com)dnl
    FEATURE(masquerade_envelope)dnl
    FEATURE(masquerade_entire_domain)dnl
    MASQUERADE_DOMAIN(domain.com)dnl
    

    Put a “dnl” in front of the line ”EXPOSED_USER (`root’) dnl”.  This enables host masquerading for root as well which is disabled by default.
    Update the Sendmail configuration files using the m4 macro processor to generate a new sendmail.cf file by executing the following command:

    # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
    

    To get the Sendmail macro file, the sendmail-cf package must be installed on the system.
    After creating a new /etc/mail/sendmail.cf file, restart Sendmail for the changes to take effect. To do this, use the following command:

    # service sendmail restart
    # nano /etc/asterisk/vm_general.inc
    

    change serveremail=vm@asterisk to whom ever you want it to appear voicemail emails are coming from.

    NOTE: If you are installing on a LAN or do not have a domain resolving to the IP of the VPS, Sendmail will hang for a couple minutes everytime you reboot.  To prevent this your VPS hostname should end with .local or .localhost.  So, for example, instead of naming the VPS hostname 'powerpbx' it should be named 'powerpbx.local'.  The manual method is to edit your /etc/hosts file.  There should be 2 lines.

    127.0.0.1 localhost.localdomain localhost

    yourIPaddress yourhostname.local yourhostname yourhostname

    Q: 如何設定 logrotate

    A:編輯 /etc/logrotate.d/asterisk

    /var/log/asterisk/messages /var/log/asterisk/*log /var/log/asterisk/full {
       missingok
       notifempty
       sharedscripts
       create 0640 asterisk asterisk
       postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
       endscript
    }
    

    Q: 外線撥入後約 15 sec 會自動掛斷,且出現錯誤訊息:

    [2012-02-29 16:41:42] WARNING[2713] chan_sip.c: Maximum retries exceeded on transmission 3c417d294417b1ff2139128123697520@sip2sip.info for seqno 103 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
    [2012-02-29 16:41:42] WARNING[2713] chan_sip.c: Hanging up call 3c417d294417b1ff2139128123697520@sip2sip.info - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions ).
    

    A: 這問題通常發生在 Asterisk 主機放在 NAT 網路環境,請依序檢查這幾項:

    • 檢查 sip.conf 的 externip, localnet 是否正確,以及 firewall 啟用 5060(UDP), 10000-20000(UDP) 的 port forwarding。
    • 檢查 canreinvite=no
    • Asterisk 執行重新開機
    • 更換其他的 firewall,pfsense 2.0.1 已確認有此問題,請參閱此篇討論,或執行下述步驟即可獲解決。
      1. Firewall > NAT > Port Forward 新增 5060(UDP) 與 10000-20000(UDP) 的 port forward 規則。
      2. Firewall > NAT > Outbound,選擇 Manual Outbound NAT rule generation (AON) 模式,並且新增規則:
        • Interface = WAN
        • Source = <Asterisk's IP>/32 ; netmask 為 32 表示為 single IP
        • Source Port = any
        • Destination = any
        • Destination Port = any
        • NAT address = any
        • NAT Port = any
        • Static Port = yes ;重要
      3. NOTE:
        • 模式 Auto NAT 切換到 Static NAT 後,系統會自動新增 3 個 rule,這不可刪除,否則 LAN 上網會有問題。
        • Static NAT Rule for Asterisk 必須在上方,否則無法被優先套用。
      4. pfsense 套用新設定後,Asterisk 需要重啟機器。

     

    • 如果撥入時是透過 SIP Provider,與 SIP Provider 端可能也會有關系,例如 CCNet 就會發生這問題,但換成 sip2sip.info 後就不會。
    • 其他非 pfsense 的 Firewall,設定時需要注意 Automatic NAT & Static NAT 的項目,此問題通常發生在 automatic NAT 模式下。
    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core