返回列表 發帖

Inter-connection between two Asterisk servers using SIP

本帖最後由 角色 於 2010-9-4 10:40 編輯

The following case shows the way to inter-connect two Asterisk servers such that users in different location can not only call internal extension numbers but also other person's extension numbers in other location directly.

Server 1:

Location: TW
Hostanme: tw.asterisk.org
Network segment: 192.168.1.0
Extension 2001: John
Extension 2002: Susan

Server 2:

Location: SZ
Hostname: sz.asterisk.org
Network segment: 192.168.2.0
Extension 3001: Peter
Extension 3002: Mary

Server 1: TW Settings:
sip.conf
  1. [general]
  2. srvlookup=yes
  3. nat=yes
  4. realm=tw.asterisk.org
  5. externhost=tw.asterisk.org
  6. fromdomain=tw.asterisk.org
  7. localnet=192.168.1.0/255.255.255.0
  8. externrefresh = 1
  9. defaultexpirey=120
  10. bindport=5060
  11. qualify=yes
  12. disallow=all
  13. allow=alaw
  14. allow=ulaw
  15. allow=gsm
  16. context=front-desk

  17. [2001]
  18. type=friend
  19. username=2001
  20. secret=2001_password
  21. callerid="John" <2001>
  22. quality=yes
  23. nat=yes
  24. host=dynamic
  25. canreinvite=no
  26. disallow=all
  27. allow=alaw
  28. context=internal

  29. [2002]
  30. type=friend
  31. username=2002
  32. secret=2002_password
  33. callerid="Susan" <2002>
  34. quality=yes
  35. nat=yes
  36. host=dynamic
  37. canreinvite=no
  38. disallow=all
  39. allow=alaw
  40. context=internal

  41. ;from SZ users call 2xxxx
  42. [tw-gw]
  43. type=user
  44. username=tw-gw
  45. secret=tw-gw_password
  46. qualify=yes
  47. nat=yes
  48. host=dynamic
  49. canreinvite=no
  50. disallow=all
  51. allow=ulaw,alaw,gsm
  52. context=internal

  53. ;to SZ telephone 3xxx
  54. [sz-gw]
  55. type=peer
  56. username=sz-gw
  57. secret=sz-gw_password
  58. host=sz.asterisk.org
  59. insecure=port,invite
  60. context=internal
複製代碼
extensions.conf
  1. [trunk_sz-gw]
  2. exten => _3XXX,1,Dial(SIP/${EXTEN}@sz-gw,,)
  3. exten => _3XXX,2,Hangup()

  4. [internal]
  5. include => trunk_sz-gw

  6. exten => 2001,1,Dial(SIP/2001,,r)
  7. exten => 2002,1,Dial(SIP/2002,,r)
複製代碼
Server 2: SZ Settings:

sip.conf
  1. [general]
  2. bindport=5060
  3. srvlookup=yes
  4. realm=sz.asterisk.org
  5. externhost=sz.asterisk.org
  6. fromdomain=sz.asterisk.org
  7. localnet=192.168.2.0/255.255.255.0
  8. defaultexpirey=120
  9. externrefresh = 1
  10. disallow=all
  11. allow=alaw,ulaw,gsm,g729,iLBC,speex
  12. nat=yes
  13. canreinvite=no
  14. insecure=port,invite
  15. qualify=yes
  16. dtmfmode=rfc2833
  17. context=fron-desk

  18. [3001]
  19. type=friend
  20. username=3001
  21. callerid="John" <3001>
  22. secret=3001_password
  23. host=dynamic
  24. context=internal

  25. [3002]
  26. type=friend
  27. username=3002
  28. callerid="Mary" <3002>
  29. secret=3002_password
  30. host=dynamic
  31. context=internal

  32. ;from TW users call 3xxx
  33. [sz-gw]
  34. type=user
  35. username=sz-gw
  36. secret=sz-gw_password
  37. qualify=yes
  38. nat=yes
  39. host=dynamic
  40. canreinvite=no
  41. disallow=all
  42. allow=alaw,ulaw,gsm
  43. context=internal


  44. ;to TW telephone 2xxx
  45. [tw-gw]
  46. type=peer
  47. username=tw-gw
  48. secret=tw-gw_password
  49. host=tw.asterisk.org
  50. insecure=port,invite
  51. context=internal
複製代碼
extensions.conf
  1. [trunk_tw-gw]
  2. exten => _2XXX,1,Dial(SIP/tw-gw/${EXTEN},,)
  3. exten => _2XXX,n,Hangup()

  4. [internal]
  5. include => trunk_tw-gw

  6. exten => 3001,1,Dial(SIP/3001,,r)
  7. exten => 3002,1,Dial(SIP/3002,,r)
複製代碼

返回列表