LAN hello world SIP

For this dialplan:

thufir@mordor:~$ 
thufir@mordor:~$ sudo head /etc/asterisk/sip.conf -n 35
[general]
context=internal
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=ulaw
alwaysauthreject=yes
canreinvite=no
nat=yes
session-timers=refuse
localnet=192.168.1.0/255.255.255.0

[7001]
type=friend
host=dynamic
secret=123
context=internal

[7002]
type=friend
host=dynamic
secret=456
context=internal

I can have 7001 and 7002 log in to the server using a softphone like Jitsi?

While I read Asterisk: The Definitive Guide, it was long ago.

There is no dialplan in your posting.

You have specified localnet but you haven’t specified how to find the public address.

Asterisk works with SIP softphones. Why do you think it will treat JITSI different from other devices?

canreinvite is deprecated, use directmedia.

nat=yes is deprecated, use the specific options needed, if you actually need any.

Unless both soft phones are on the same IP address, type=peer is safer than type=friend.

1.) I’m trying to add a dialplan.

2.) localnet, yes. By public address, you just mean public to the localnet, not across the internet?

3.) at the moment, it’s all on the same IP address. I’ll add other pc’s on the LAN and at least one hardphone.

updated sip.conf and extensions.conf:

root@mordor:/etc/asterisk# 
root@mordor:/etc/asterisk# head -n 27 sip.conf 
[general]
context=internal
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=ulaw
alwaysauthreject=yes
directmedia=yes
nat=force_rport,comedia
session-timers=refuse
localnet=192.168.1.0/255.255.255.0

[7001]
type=peer
host=dynamic
secret=123
context=internal

[7002]
type=peer
host=dynamic
secret=456
context=internal

root@mordor:/etc/asterisk# 
root@mordor:/etc/asterisk# head -n 5 extensions.conf
[from-internal]
exten=>7001,1,Dial(SIP/demo-alice,20)
exten=>7002,1,Dial(SIP/demo-bob,20)


root@mordor:/etc/asterisk# 

I wanted to look at the dialplan through the CLI, but the output was hundreds of lines long. How and where do I define demo-bob and demo-alice?

What is more likely with localnet is that it is unneeded. However, if it is needed, you need to specify the address on the internet (or at least on the extranet).

You probably still have the sample files for AEL, and maybe other ways of specifying the dialplan. Remove them.

demo_alice and demo_bob should be defined in your sip.conf. They replace the 7001 an 7002 there, and in the softphone configuration.

but extensions.conf has:

Should they match?

When a softphone (Jitsi) on the same pc as Asterisk connects, it uses demo_bob and his secret password as defined in sip.conf, but what is his full SIP address? How does he connect to Asterisk?

Jitsi shows demo_bob as a RegistrarLes SIP account:

(While the box has a FQDN, it’s not registered anywhere, really, it’s just a freebie from noip.com. I’m only trying to go across the LAN, not the internet. Should I remove localnet from the general context?)

The context names should match. Remove localnet. I’m not familiar with your softphone.

The address of record should probably be sip:demo-alice@127.0.0.1.

Ok, got it working as:

mordor*CLI> 
mordor*CLI> sip show users
Username                   Secret           Accountcode      Def.Context      ACL  Forcerport
demo_bob                   456                               internal         No   Yes       
demo_alice                 123                               internal         No   Yes       
mordor*CLI> 
mordor*CLI> dialplan show internal
[ Context 'internal' created by 'pbx_config' ]
  '6001' =>         1. Dial(SIP/demo_alice,20)                    [pbx_config]
  '6002' =>         1. Dial(SIP/demo_bob,20)                      [pbx_config]

-= 2 extensions (2 priorities) in 1 context. =-
mordor*CLI> 
  == Using SIP RTP CoS mark 5
    -- Executing [6002@internal:1] Dial("SIP/demo_alice-00000008", "SIP/demo_bob,20") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/demo_bob
    -- SIP/demo_bob-00000009 is ringing
    -- SIP/demo_bob-00000009 is ringing
    -- SIP/demo_bob-00000009 is ringing
    -- SIP/demo_bob-00000009 is ringing
    -- SIP/demo_bob-00000009 answered SIP/demo_alice-00000008
    -- Channel SIP/demo_alice-00000008 joined 'simple_bridge' basic-bridge <17bb6864-e714-4a3b-9ef7-acfc611abbe5>
    -- Channel SIP/demo_bob-00000009 joined 'simple_bridge' basic-bridge <17bb6864-e714-4a3b-9ef7-acfc611abbe5>
       > Bridge 17bb6864-e714-4a3b-9ef7-acfc611abbe5: switching from simple_bridge technology to native_rtp
       > 0x7f4884011210 -- Probation passed - setting RTP source address to 192.168.1.6:4008
    -- Channel SIP/demo_bob-00000009 left 'native_rtp' basic-bridge <17bb6864-e714-4a3b-9ef7-acfc611abbe5>
    -- Channel SIP/demo_alice-00000008 left 'native_rtp' basic-bridge <17bb6864-e714-4a3b-9ef7-acfc611abbe5>
  == Spawn extension (internal, 6002, 1) exited non-zero on 'SIP/demo_alice-00000008'
mordor*CLI> 

Using Jitsi on localhost and csip-simple on a tablet. Not all softphones allow an IP address in the SIP address. (?)

Thank you :slight_smile: