Board logo

標題: HKBN 2b Asterisk两种注册参数可能 [打印本頁]

作者: 角色    時間: 2010-8-9 07:47     標題: HKBN 2b Asterisk两种注册参数可能

本帖最後由 角色 於 2010-8-10 05:47 編輯

在HKBN 2b,给你电话中,会出现两组注册参数,不能从电话里面猜测出来,要具体测试。如果第一组不成功,改用第二组设定。

假如HKBN 2b给你的电话号码和密码是

2b Telephone Number:36123456
2b Telephone Password :your_2b_password

Outbound Calls
打出的prefix是 9,那么拨打香港电话为:9 + <HK Telephone numbers>
<HK Telephone numbers> : 3 or more digits HK Telephone numbers

Inbound Calls
打入用extension 6001接。


第一组 Asterisk 2b settings

1) Edit /etc/hosts, add the following line:
203.80.89.135   s2hkbntel.net s21.hkbntel.net

2) Edit /etc/asterisk/sip.conf and add the following lines:

register => 36123456hk:your_2b_password@s2hkbntel.net:5060/36123456

[hkbn2b]
type=peer
nat=yes
username=3123456hk
secret=your_2b_password
port=5060
host=s2hkbntel.net
fromuser=36123456hk
fromdomain=s2hkbntel.net
canreinvite=no
insecure=very
disallow=all
;allow=ulaw
allow=alaw
dtmfmode=auto
context=from-hkbn

3) Edit/etc/asterisk/extensions.conf by adding the following lines

;HKBN 2b outbound calls
exten => _9XX.,1,Dial(SIP/${EXTEN:1}@hkbn2b,,r)
exten => _9XX.,n,Hangup()

;HKBN 2b inbound calls
[from-hkbn]
exten => 36123456,1,Dial(SIP/6001,,r)
exten => 36123456,n,Hangup()


第二组 Asterisk 2b settings

1) Edit /etc/hosts, replace the old one in the first settings "203.80.89.135   s2hkbntel.net s21.hkbntel.net" by the following line. Others remain unchanged.

203.80.89.139   s2hkbntel.net s22.hkbntel.net

For details, please refer to http://www.voip-info.org/wiki/view/asterisk+settings+HKBN+2b

YH
作者: ckleea    時間: 2010-8-9 09:22

謝謝角色兄,會否合力做一本中港台的VOIP 手冊,總結大家的心德。
作者: 角色    時間: 2010-8-9 10:09

先感谢你有这样的热情,你这个想法非常好,在网上根本没有这个的中文材料,都是我们一点一滴积累下来的成果。

你的想法非常赞同,其实在的电脑里有【香港一人一VoIP电话】和【香港一人一Asterisk Server】。有时间我把资料整理好,然后大家可以参与修改或者增补都可以。

角色
作者: ckleea    時間: 2010-8-9 11:23

還有是一個簡單資料庫放files 如我們的 codecs
作者: 角色    時間: 2010-8-9 16:21

已经放在固顶里的link里。

角色
作者: ckleea    時間: 2010-8-10 17:33

另外在 Asterisk 1.6.2.X 發生的問題,切勿加入outbound CID in the user extensions. ,因為會今HKBN2b 錯誤而得出 Got SIP response 500 "Server Internal Error" back from 203.80.89.139

現在出入正常,謝謝角色兄的協助。
作者: 角色    時間: 2010-8-10 18:18

那么你可以享受多线“同时”打出和打入的SIP Trunk乐趣。这个跟FXO port完全不同概念。如果跟它比,可能是E1 Trunk吧!

角色
作者: ckleea    時間: 2010-8-10 18:23

還有,遲些和大家分享,將2b放入 自己 favorite's Desktop PC sip client, In & Out 都冇問題。

我用Zoiper paid up 版,可以使用不同的 SIP & IAX connections
作者: ckleea    時間: 2010-8-11 13:03

可否再協助,現在打出冇問號,不過打入全接留言。
作者: 角色    時間: 2010-8-11 22:15

你是都有多过一个2b号码呢?

角色
作者: ckleea    時間: 2010-8-14 22:03

Very disappointed.  For unknown reason, inbound for my HKBN 2b account is ok. But now outbound still have problems.
Either 500 error or 603 error

My sip.conf
[general]
context = default
allowoverlap = no
bindport = 5060
bindaddr = 0.0.0.0
srvlookup = yes
autodomain = no
callevents = no
defaultexpiry = 90
dtmfmode = rfc2833
externrefresh = 10
localnet = 192.168.118.0/255.255.255.128
nat = yes
notifyringing = yes
qualify = 3000
domain =

register = 35635612hk:secret@s2hkbntel.net:5060/35635612

[hkbn2b]
type = peer
nat = yes
username = 355635612hk
secret = secret
port = 5060
host = s2hkbntel.net
fromuser = 35635612hk
fromdomain = s2hkbntel.net
canreinvite = no
insecure = no
disallow = all
allow = alaw
dtmfmode = auto
context = from-hkbn2b

Any suggestion?
作者: 角色    時間: 2010-8-14 22:18

What is the error message when you are trying to make outbound calls via 2b trunk?

YH
作者: ckleea    時間: 2010-8-14 22:54

either 500 internal server error or 603 call declined. If you search for 603 error, no definitive error description.
For out going, I think the context [hkbn2b] should be the my focus. However, I have no idea why. I have put similar string into IP01 which is asterisk 1.4 but no luck
作者: 角色    時間: 2010-8-14 23:03

Please let me see the settings for 2b outbound call in your extensions.conf.

YH
作者: ckleea    時間: 2010-8-14 23:05

;dial-out via HKBN 2b
[CallingRule_hkbn-out_nocid]
exten => _9XXXXXXXX,1,Dial(SIP/133${EXTEN:1}@hkbn2b)
exten => _9XXXXXXXX,n,Hangup()
作者: 角色    時間: 2010-8-14 23:10

Since you are using Digium Asterisk-GUI to connect your 2b service, you may go to the HKEPC forum to check the thread 【ATCOM IP-01 + FXO】for the codes for 2b registration.

YH
作者: ckleea    時間: 2010-8-14 23:15

no, I use the registration string in sip.conf as showed by you above.
作者: 角色    時間: 2010-8-15 15:58

How is it going?  Are you able to make outbound calls now?

YH
作者: ckleea    時間: 2010-8-15 16:33

Still 603 error.
作者: 角色    時間: 2010-8-15 19:40

Are you using Digium Asterisk-GUI or using Asterisk Programming Language in configuring your 2b?

YH
作者: ckleea    時間: 2010-8-15 21:01

APL now. I do not configure HK2b as VOIP trunk under GUI
作者: 角色    時間: 2010-8-15 21:24

You meant you use using APL in a machine with Asterisk-GUI 2.0 installed right?

YH
作者: ckleea    時間: 2010-8-15 22:00

Yes. To generate the code, I would use APL which is faster and can test easily. It is slow to test with GUI.

I use WINSCP and putty to edit and login asterisk console.
When finished editing, a reload command at console
作者: ckleea    時間: 2010-8-16 12:45

Should I go back to Asterisk 1.4?

I have try to put the registration into IP01 but not working. The next will be into a DD-WRT router which is limiting in function.
作者: 角色    時間: 2010-8-16 14:02

For IP-01, lttliang has one and he put his 2b in ip-01 without any problems in both outbound and inbound calls.

YH
作者: ckleea    時間: 2010-8-16 15:10

I disable the 2b registration in asterisk and use their software, I think it may be due to the of s21.hkbntel.net and s22.hkbntel.net

When I fix to s21.hkbntel.net, it keeps return to s22.hkbntel.net. Somethings wrong not sure what to do next.
作者: ckleea    時間: 2010-8-16 17:19

HKBN also provides a VPN client to use their soft phone. I am actively looking up the information
作者: 角色    時間: 2010-8-16 18:31

If you still have problem, I may help you by letting me know the credentials of your 2b again. I shall implement in my Asterisk 1.4 server in Hong Kong. If it works for both inbound and outbound calls in Asterisk 1.4, then I believe there may be some settings in Asterisk 1.6 that you have figured out what they are.

YH
作者: ckleea    時間: 2010-8-16 19:03

Will try this one tonight to look into the sip message

http://sipx-wiki.calivia.com/ind ... Messages_to_display
作者: 角色    時間: 2010-8-16 19:37

It seems that you are trying your very best to fix the 2b problem yourself. I wish you could make your 2b system work.
作者: ckleea    時間: 2010-8-16 20:09

Try to learn and debug whatever I can. Everyone is helpful, in particular 角色.
Once I got it fix, I can then share my experience.
作者: ckleea    時間: 2010-8-17 09:19

I hope I can fix it. Perhaps one of the problems is the IP address. I notice that the requesting and then returning IPs are different. Keep trying
作者: ckleea    時間: 2010-9-26 14:55

Finally, I manage to get both inbound and outbound work. But not yet fixed up the IVR to catch the call.

HKBN to extension - no problem
to IVR, failed, either invalid extension or failed.
作者: 角色    時間: 2010-9-26 16:26

Very good news!How can you do it? What are the problems encountered in the past and the way to fix the problems?

Try to put your IVR under the [internal] label such that it can see all the internal extensions.

YH
作者: ckleea    時間: 2010-9-26 16:36

My sip.con is like this

[general]
context = default
srvlookup = no
nat = yes
realm = Realm
externhost = xxx.yyy.zzz
fromdomain = xxx.yyy.zzz
localnet = 192.168.118.0/255.255.255.128  ;change it as per your Asterisk network address
localnet = 192.168.1.0/255.255.255.0
externrefresh = 180
defaultexpirey = 120
bindport = 5060
pedantic = no
qualify = yes
tos = cs3
tos_audio = ef
tos_video = af41
disallow = all
allow = alaw
allow = ulaw
allow = gsm
;domain =
autodomain = no
bindaddr = 0.0.0.0
allowexternalinvites=no
alwaysauthreject=no
allowexternaldomains=no

register => 35678900hk:password@s2hkbntel.net/35678900

[hkbn2b]
type = friend
nat = yes
username = 35678900hk
secret = password
port = 5060
host = s2hkbntel.net
fromuser = 35678900hk
fromdomain = s2hkbntel.net
canreinvite = no
insecure = invite
disallow = all
allow = alaw
;dtmfmode = rfc2833
context = from-hkbn2b
outboundproxy = 203.80.89.139
quality = no

This is in a multiWAN environment with centos based asterisk server, IP01 with switchfin firmware and a DD-WRT router.

Only problem now is the IVR, somehow it drops.
If I forward to a SIP phone, it rings with callerID.
作者: ckleea    時間: 2010-9-26 17:58

My error is like this
  -- Executing [1000@default:4] WaitExten("SIP/domain2b.hkbn.net-000000fd", "5") in new stack
    -- Timeout on SIP/domain2b.hkbn.net-000000fd, continuing...
    -- Executing [1000@default:5] Hangup("SIP/domain2b.hkbn.net-000000fd", "") in new stack
  == Spawn extension (default, 1000, 5) exited non-zero on 'SIP/domain2b.hkbn.net-000000fd'

Can't take my extensions
作者: 角色    時間: 2010-9-26 18:27

Please take a look at my ivr example but I forgot the location.

YH
作者: ckleea    時間: 2010-9-27 21:39

No idea now that dial out is not working. Registration sometimes success, sometimes timeout. I got 603 declined error
作者: bubblestar    時間: 2010-10-4 11:30

本帖最後由 bubblestar 於 2010-10-4 11:31 編輯

I have just read a post from http://forums.whirlpool.net.au/archive/1133054 which might be useful to you to fix the outbound or inbound problems on Asterisk 1.6 based server system.  The possible culprit is insecure and or type that happened only on Asterisk 1.6

I extracted part of the content for your easy reference.  Hope it helps you out.

Background

The setup:
Asterisk 1.6 on an externally hosted box.
A standard Engin account to receive and make calls. (this may correspond to some company like HK2b)

The Problem:
While everything was sweet with v1.4, 1.6 would not accept incoming calls. You would get an engaged signal from a telstra PSTN line. Engin to Engin would simply hang up.

The Solution:
For some strange reason, you don't have to be insecure=whatever to make outbound calls. But you need it configured to receive inbound calls.

insecure=very has been left out of asterisk 1.6 so you need to use insecure=invite,port to get the same result.

But I had configured that in the inbound type=user channel setup. For whatever reason you also have to configure it in the outbound type=peer channel setup.
作者: ckleea    時間: 2010-10-4 11:45

Thanks, bubblestar 兄, the information is reasonable and similar to my understanding of the underlying problem.

One can conclude that asterisk 1.6 has created its own set of problems.
作者: ckleea    時間: 2010-10-6 00:13

I have just read a post from  which might be useful to you to fix the outbound or inbound problems o ...
bubblestar 發表於 2010-10-4 11:30


May not be 100% working.
   
Now, I add the following in the general section of sip.conf

stunaddr = stun.xten.com
作者: 角色    時間: 2010-10-6 07:52

You meant with the added STUN server, your 2b outbound calls always work but not for inbound calls, right?

YH
作者: ckleea    時間: 2010-10-6 08:59

回復 42# 角色

Now, both works. However, I believe the underlying problem is asterisk 1.6
Unfortunately, no time or choice to downgrade to 1.4
作者: ckleea    時間: 2010-10-23 09:39

An update:

The problem is in asterisk 1.6 but also in my router. In the former, it is the variable, type and insecure. But also note that router issue is important. Because of using more than one IP, when the outgoing connection is made, different IPs may be associated. In return at the authenization phase, IPs mismatched. Now I fix this by looking at my outgoing firewall rules, and bound to a fixed wan IP . No problem so far.

The usual internal extension under one asterisk server works with the present auto-attendant script. When try to press extension of other asterisks or try other dialplan, it generates invalid extension.
作者: 電腦超人    時間: 2011-1-17 16:00

我是用1.8的...但按照之前的設定...出了以下錯誤...
    -- Called XXXXXXXX@s2hkbntel
    -- Got SIP response 301 "Moved Permanently" back from 203.80.89.135:5060
    -- Now forwarding SIP/6004-00000002 to 'Local/XXXXXXXX@from-hkbn' (thanks to SIP/s2hkbntel-00000003)
[Jan 17 15:52:37] NOTICE[23963]: app_dial.c:844 do_forward: Not accepting call completion offers from call-forward recipient Local/XXXXXXXX@from-hkbn-36f0;1
[Jan 17 15:52:37] NOTICE[23963]: chan_local.c:800 local_call: No such extension/context XXXXXXXX@from-hkbn while calling Local channel
[Jan 17 15:52:37] NOTICE[23963]: app_dial.c:915 do_forward: Forwarding failed to dial 'Local/XXXXXXXX@from-hkbn'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [XXXXXXXX@internal:2] Hangup("SIP/6004-00000002", "") in new stack

我大概是跟著以前epc時的設定的...
http://www.hkepc.com/forum/redir ... 74&pid=20368375

不知是否設定錯了甚麼呢?
作者: ckleea    時間: 2011-1-17 16:45

試下更改 /etc/hosts 如下

;203.80.89.135       s2hkbntel.net s21.hkbntel.net
203.80.89.139                s2hkbntel.net s22.hkbntel.net
;203.80.89.146        s2hkbntel.net s23.hkbntel.net
;203.80.89.150        s2hkbntel.net s24.hkbntel.net

記得行 service network restart

假定你用 Centos /Redhat linux
作者: 電腦超人    時間: 2011-1-18 02:11

4個也不行...
這次是顯示
  == Using SIP RTP CoS mark 5
    -- Called XXXXXXXX@s2hkbntel
    -- No one is available to answer at this time (1:0/0/0)
    -- Executing [XXXXXXXX@internal:2] Hangup("SIP/6001-00000016", "") in new stack
  == Spawn extension (internal, XXXXXXXX, 2) exited non-zero on 'SIP/6001-00000016'
作者: ckleea    時間: 2011-1-18 06:31

Please reboot your server once. It happens to me many times recently. YH advised me to reboot. It will work again.
作者: 電腦超人    時間: 2011-1-18 12:10

reboot後也是不行...
看來我要再找找是甚麼問題了...
作者: ckleea    時間: 2011-1-18 14:01

回復 49# 電腦超人

Also reboot your router and try to go into 2b web page to reset your setting.

It just happens again to me last night. It is back to normal.
作者: ckleea    時間: 2011-1-18 21:01

Yes, I confirm that it is back to normal.

Try this link to reset your 2b account

http://pa.2b.com.hk/login.jsp
作者: 電腦超人    時間: 2011-1-19 06:31

試過都係唔得...

Router都做哂port forward...
尋日試過搵X-Lite都成功...
作者: ckleea    時間: 2011-1-19 08:18

回復 52# 電腦超人


你用x lite 註冊?
一般我上述的方法是 work,不過可能需要 timeout 一段時間。
作者: bubblestar    時間: 2011-1-19 09:09

電腦軟件不如硬件電話,始終要面對cache 問題。應該要想想辦法每隔一段時間自動清洗Cache 便好了。
作者: 電腦超人    時間: 2011-1-19 12:41

回復  電腦超人


你用x lite 註冊?
一般我上述的方法是 work,不過可能需要 timeout 一段時間。 ...
ckleea 發表於 2011-1-19 08:18

我試過用X-Lite是OK的...
跟著在pa reset後才再在asterisk註冊...但還是不行...

都係出"No one is available to answer at this time"
作者: ckleea    時間: 2011-1-19 13:09

回復 55# 電腦超人

Do you have other device login at the same time? Multiple login will require on client to time out for quite some time before allow to use 2b again.

I have this experience before
作者: 電腦超人    時間: 2011-1-19 14:00

回復  電腦超人

Do you have other device login at the same time? Multiple login will require on cli ...
ckleea 發表於 2011-1-19 13:09

應該冇架喎...
我係初初拎個a/c之後試過login到就已經冇用過個2b software...

而且我o係pa度reset過都唔得...
作者: 電腦超人    時間: 2011-1-19 18:46

其實我在想...會否與我安裝時make sample有關...
因為不知道原有設定會否影響我所修改的...

以及看了會否和router(ClearOS)有關...

我也試過把設定在IP01的GUI介面設定...不過好像也是不行...
作者: 電腦超人    時間: 2011-1-19 18:46

其實我在想...會否與我安裝時make sample有關...
因為不知道原有設定會否影響我所修改的...

以及看了會否和router(ClearOS)有關...

我也試過把設定在IP01的GUI介面設定...不過好像也是不行...
作者: ckleea    時間: 2011-1-19 19:13

回復 59# 電腦超人


    What have you done? Install asterisk 1.8.2? just save a copy of the new one and then recover the old conf files. Try again. There have been changes in the confi but not that many. For me, I just use my 1.6 config files directly on 1.8 asterisk. No change of any config files.
作者: bubblestar    時間: 2011-1-19 20:56

回復 60# ckleea


   
你係就咁把 1.6 的 config files 蓋落 1.8 度,定係先把1.8 config files 清洗掉,才把1.6 放落去呢?  如果是後者,會有機會把1.8 新增的一些config files 一併擦掉呢!
作者: ckleea    時間: 2011-1-19 23:17

本帖最後由 ckleea 於 2011-1-20 06:34 編輯

I can't recall.
They are the lists of config files I have in my /etc/asterisk directory
  1. adsi.conf                cdr_tds.conf             dundi.conf              logger.conf             res_pgsql.conf
  2. adtranvofr.conf          cel.conf                 enum.conf               manager.conf            res_pktccops.conf
  3. agents.conf              cel_custom.conf          espeak.conf             meetme.conf             res_snmp.conf
  4. ais.conf                 cel_odbc.conf            extconfig.conf          mgcp.conf               res_stun_monitor.conf
  5. alarmreceiver.conf       cel_pgsql.conf           extensions.ael          minivm.conf             rpt.conf
  6. alsa.conf                cel_sqlite3_custom.conf  extensions.conf         misdn.conf              rtp.conf
  7. amd.conf                 cel_tds.conf             extensions.lua          modules.conf            say.conf
  8. app_mysql.conf           chan_dahdi.conf          extensions_minivm.conf  musiconhold.conf        sip.conf
  9. asterisk.adsi            chan_mobile.conf         features.conf           muted.conf              sip_nat.conf
  10. asterisk.conf            chan_ooh323.conf         festival.conf           ooh323.conf             sip_notify.conf
  11. asterisk.sh              cli_aliases.conf         flite.conf              osp.conf                skinny.conf
  12. calendar.conf            cli.conf                 followme.conf           oss.conf                sla.conf
  13. calendar.conf.work       cli_permissions.conf     func_odbc.conf          phone.conf              smdi.conf
  14. ccss.conf                codecs.conf              gtalk.conf              phoneprov.conf          telcordia-1.adsi
  15. cdr_adaptive_odbc.conf   console.conf             guipreferences.conf     queuerules.conf         udptl.conf
  16. cdr.conf                 custom_dp.conf           h323.conf               queues.conf             unistim.conf
  17. cdr_custom.conf          dahdi-channels.conf      http.conf               res_config_mysql.conf   usbradio.conf
  18. cdr_manager.conf         dahdi_guiread.conf       iax.conf                res_config_sqlite.conf  users.conf
  19. cdr_mysql.conf           dahdi_guiRead.conf       iaxprov.conf            res_curl.conf           voicemail.conf
  20. cdr_odbc.conf            dahdi_scan.conf          incoming.conf           res_fax.conf            vpb.conf
  21. cdr_pgsql.conf           dbsep.conf               indications.conf        res_fax_digium.conf     ztscan.conf
  22. cdr_sqlite3_custom.conf  dnsmgr.conf              jabber.conf             res_ldap.conf
  23. cdr_syslog.conf          dsp.conf                 jingle.conf             res_odbc.conf
複製代碼

作者: 電腦超人    時間: 2011-1-20 08:45

回復  ckleea


   
你係就咁把 1.6 的 config files 蓋落 1.8 度,定係先把1.8 config files 清洗掉,才 ...
bubblestar 發表於 2011-1-19 20:56

我的1.8是新裝的...
早前是1.8.1.1(?)...最近更新了1.8.2...
更新的時候沒有刪改任何config files...基本上只是跟著bubblestar兄早前的那個貼來更新...
作者: ckleea    時間: 2011-1-22 13:49

回復 63# 電腦超人

Back to normal for HKBN2B
作者: 雯雯    時間: 2012-7-22 15:14

提提大家! 如果2B是set在NAS Asterisk, /etc/hosts檔案每次reboot都會被還原成default, 解決方法是寫個autorun.sh.
作者: 角色    時間: 2012-7-24 22:14

回復 65# 雯雯

这个问题,想你那样说,在Autorun.sh里去写该/etc/hosts , 而这个script在SXX里运行(像其他rc.local)一样。
作者: sbbcnn    時間: 2012-8-28 22:43

我的2b context 只能用 from-pstn 才能打入, from-sip 或 context=from-hkbn 都不行.  这个叁数是怎样用的?
作者: 角色    時間: 2012-8-28 23:55

from什么应该在sip.conf里HKBN 2b的sip definition of sip.conf。
里面context去define的。
作者: sbbcnn    時間: 2012-8-29 15:43

from什么应该在sip.conf里HKBN 2b的sip definition of sip.conf。
里面context去define的。
角色 發表於 2012-8-28 23:55


在 sip_additional.conf 內找到, 但不明白使用方法   雖然目前elastix 運作正常,  就是SPA3K 的 line 1無法解決.
et263 是 from-desk
2b 是 from-pstn
spa300 是 from-pstn
作者: 角色    時間: 2012-8-29 20:41

可能大家用的系统不一样导致,我用是只是Asterisk Engine,你用Asterisk Engine + GUI。大家的切入点不一样,我用Asterisk Engine,你用的是GUI在Asterisk Engine之上。




歡迎光臨 電訊茶室 (http://telecom-cafe.com/forum/) Powered by Discuz! 7.2