I tried to register a phone after applying the changes and Kamailio forwarded the register request to Asterisk only once and without successful authentication ! now i didn't change anything in the configuration file and can NOT get any registration requests forwarded from Kamailio to Asterisk and get only events on Kamailio that it can NOT register the incoming registration request like this.
root@debian:/usr/local/etc/kamailio# ngrep -W byline -d eth1 port 5060
U
192.168.50.2:50886 ->
192.168.50.1:5060REGISTER sip:192.168.50.1 SIP/2.0.
Via: SIP/2.0/UDP 192.168.50.2:50886;branch=z9hG4bK-d8754z-cb65023b979d0a36-1---d8754z-;rport.
Max-Forwards: 70.
Contact: <sip:1001@192.168.50.2:50886;rinstance=8000799665fa4b54>.
To: "Mahmoud Ramadan Ali"<
sip:1001@192.168.50.1>.
From: "Mahmoud Ramadan Ali"<
sip:1001@192.168.50.1>;tag=9f381b5f.
Call-ID: MzcxNzYwMmUyN2E0M2FkMWRmOTI0ZjNkMjJmNWNhYTc.
CSeq: 2 REGISTER.
Expires: 3600.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO.
User-Agent: X-Lite 4.7.1 74247--W6.1.
Authorization: Digest username="1001",realm="192.168.50.1",nonce="VGqbxVRqmpngschsiE6AuMiOfCS/MIp7",uri="sip:192.168.50.1",response="1788f6b9cfc322b863a93c91f3b623dc",algorithm=MD5.
Content-Length: 0.
#
U
192.168.50.1:5060 ->
192.168.50.2:50886SIP/2.0 401 Unauthorized.
Via: SIP/2.0/UDP 192.168.50.2:50886;branch=z9hG4bK-d8754z-cb65023b979d0a36-1---d8754z-;rport=50886.
To: "Mahmoud Ramadan Ali"<
sip:1001@192.168.50.1>;tag=b27e1a1d33761e85846fc98f5f3a7e58.0bcb.
From: "Mahmoud Ramadan Ali"<
sip:1001@192.168.50.1>;tag=9f381b5f.
Call-ID: MzcxNzYwMmUyN2E0M2FkMWRmOTI0ZjNkMjJmNWNhYTc.
CSeq: 2 REGISTER.
WWW-Authenticate: Digest realm="192.168.50.1", nonce="VGqbxVRqmpngschsiE6AuMiOfCS/MIp7".
Server: kamailio (4.1.6 (i386/linux)).
Content-Length: 0.
But when using the Ngrep command on Asterisk to capture traffic on port 5050 or even 5060 i get no thing ! other troubleshooting steps i followed including :
1.Verfiying the Mysql connection from Kamailio and the account tabe name and SIP username / password column.
root@debian:/usr/local/etc/kamailio# mysql -u sipuser -h 192.168.100.10 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 149
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use asterisk;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SELECT * FROM sip;
+------+------------------+---------------------------------+-------+
| id | keyword | data | flags |
+------+------------------+---------------------------------+-------+
| 1001 | pickupgroup | | 22 |
| 1001 | callgroup | | 21 |
| 1001 | encryption | no | 20 |
| 1001 | icesupport | no | 19 |
| 1001 | force_avp | no | 18 |
| 1001 | avpf | no | 17 |
| 1001 | transport | udp,tcp,tls | 16 |
| 1001 | qualifyfreq | 60 | 15 |
| 1001 | qualify | yes | 14 |
| 1001 | port | 5050 | 13 |
| 1001 | nat | no | 12 |
| 1001 | type | friend | 11 |
| 1001 | sendrpid | no | 10 |
| 1001 | trustrpid | yes | 9 |
| 1001 | host | dynamic | 8 |
| 1001 | context | from-internal | 7 |
| 1001 | canreinvite | no | 6 |
| 1001 | dtmfmode | rfc2833 | 5 |
| 1001 | secret | 1001secret | 4 |
| 1001 | secret_origional | 1001secret | 3 |
| 1001 | sipdriver | chan_sip | 2 |
| 1001 | dial | SIP/1001 | 25 |
| 1002 | pickupgroup | | 22 |
| 1002 | callgroup | | 21 |
| 1002 | encryption | no | 20 |
| 1002 | icesupport | no | 19 |
| 1002 | force_avp | no | 18 |
| 1002 | avpf | no | 17 |
| 1002 | transport | udp,tcp,tls | 16 |
| 1002 | qualifyfreq | 60 | 15 |
| 1002 | qualify | yes | 14 |
| 1002 | port | 5060 | 13 |
| 1002 | nat | no | 12 |
| 1002 | type | friend | 11 |
| 1002 | sendrpid | no | 10 |
| 1002 | trustrpid | yes | 9 |
| 1002 | host | dynamic | 8 |
| 1002 | context | from-internal | 7 |
| 1002 | canreinvite | no | 6 |
| 1002 | dtmfmode | rfc2833 | 5 |
| 1002 | secret | 1002secret | 4 |
| 1002 | secret_origional | 1002secret | 3 |
| 1002 | sipdriver | chan_sip | 2 |
| 1002 | dial | SIP/1002 | 25 |
| 1002 | disallow | | 23 |
| 1002 | allow | | 24 |
| 1002 | accountcode | | 26 |
| 1002 | mailbox | 1002@device | 27 |
| 1002 | deny |
0.0.0.0/0.0.0.0 | 28 |
| 1002 | permit |
0.0.0.0/0.0.0.0 | 29 |
| 1002 | account | 1002 | 30 |
| 1002 | callerid | Ahmed Ramadan's Device <1002> | 31 |
| 1001 | disallow | | 23 |
| 1001 | allow | | 24 |
| 1001 | accountcode | | 26 |
| 1001 | mailbox | 1001@device | 27 |
| 1001 | deny |
0.0.0.0/0.0.0.0 | 28 |
| 1001 | permit |
0.0.0.0/0.0.0.0 | 29 |
| 1001 | account | 1001 | 30 |
| 1001 | callerid | Mahmoud Ramadan's Device <1001> | 31 |
+------+------------------+---------------------------------+-------+
60 rows in set (0.00 sec)
2.Verifying that Asterisk can listen at 5050 which is the same Asterisk port configured on Kamailio.
[root@Asterisk VM 01 ~]# asterisk -r
Asterisk 11.13.1, Copyright (C) 1999 - 2013 Digium, Inc. and others.
Created by Mark Spencer <
markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 11.13.1 currently running on Asterisk VM 01 (pid = 2456)
Asterisk VM 01*CLI> sip show settings
Global Settings:
----------------
UDP Bindaddress:
0.0.0.0:5050I know it is a long message but i wanted to give you all the INFO you might need also I've attached my configuration file so you can check it.Thank you Mohamed for your assistance.