jackbboy / csipsimple

Automatically exported from code.google.com/p/csipsimple
0 stars 0 forks source link

Filters aren't working for accounts with a local LAN asterisk server #908

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create an account and register to an asterisk server in local LAN
2.set a filter rule on this account
3.try to call your terminal from another phone registered on the same asterisk 
server and the same lan that should match the rule

What is the expected output? What do you see instead?
i expect that the rule is matched and right action is performed, for example an 
auto-answer. Instead no rule is matched and the csipsimple ui start to ring 
waiting for user action to answer

What version of the product are you using? On what operating system?
revision 771

Please provide any additional information below.
I'm trying in a voip network where:
Asterisk server: 192.168.4.1
CSipSimple client: tablet1@192.168.4.79
Other client (hw phone): 203@192.168.4.45

Both client are registered to the asterisk server. The dialplan on the asterisk 
server send all the calls coming from the hw phone to the csipsimple client 
dialing the number 206.

When i call 206 from the hw phone, on the asterisk debug i get this:

----
INVITE sip:tablet1@192.168.4.79:5060;transport=UDP;ob SIP/2.0
Via: SIP/2.0/UDP 192.168.4.1:5060;branch=z9hG4bK4d785c1d;rport
Max-Forwards: 70
From: "labhw" <sip:203@192.168.4.1>;tag=as12d1a43a
To: <sip:tablet1@192.168.4.79:5060;transport=UDP;ob>
Contact: <sip:203@192.168.4.1>
Call-ID: 2babfa947d4737b0609e40142d592718@192.168.4.1
CSeq: 102 INVITE
-----

On the debug log of the csipsimple client i get:
-----
D/SIP UA Receiver(12539): > UNLOCK CPU 0
D/SIP SRV (12539): Search if should I auto answer for "labhw" 
<sip:203@192.168.4.1>
D/SIP SRV (12539): Oupps... that come from an unknown account...
D/SIP UA Receiver(12539): Should I anto answer????false
D/SIP SRV (12539): Search if should I auto answer in background for "labhw" 
<sip:203@192.168.4.1>
D/SIP SRV (12539): Oupps... that come from an unknown account...
D/SIP UA Receiver(12539): Should I anto answer????false
-----

So, the issue seems to be that the csipsimple client doesn't recognize that the 
call is coming for the "tablet1" account, so, the filter rules are never 
matched cause it doesn't recognize the right account.

If i make the account with "expert mode" and i put <sip:tablet1@192.168.4.79> 
ad Id account, the rules are matched and all is working, but this can be a work 
around as the 4.79 ip address is dynamic by dhcp, and anyway except for expert 
mode other mode accounts aren't working too.

Original issue reported on code.google.com by antanisa...@gmail.com on 26 Apr 2011 at 12:32

GoogleCodeExporter commented 9 years ago
I guess your sip server is configured in CSipSimple with a fully qualified 
domain name, isn't it?
However your sip server announce itself as being a simple IP 192.168.4.1. 
Besides it probably does not use the already opened register socket. And the 
call comes probably directly either from the remote party or from the asterisk 
without using the register socket.
Anyway, you are in a situation that should not happen with a sip server that 
try to call the registered contact and *not* the contact directly. 
So the application consider this call as a call that comes from anywhere but 
not your asterisk sip account.

And as you already said, and as suggested by logs, in this case filtering rule 
will not match.
I could add a special entry for local account filtering, however an easier way 
is to create a "Local" account (using corresponding wizard). And use it to set 
filter on it.

In this case, as your sip server directly call the local account of the sip 
client, csipsimple will detect that it comes from a known account (the local 
account), and apply local account filtering rules.
Let me know how it goes with this solution but I think it will help.
If you don't want to create the local account, the other solution would be to 
configure asterisk server so that it send the invite to the sip client a way 
the sip client detect the fact it comes from this server.

Original comment by r3gis...@gmail.com on 26 Apr 2011 at 12:56

GoogleCodeExporter commented 9 years ago
Just to let you know ( and maybe can be usefull for others in future ), using a 
local account won't solve the issue. Anyway, i found a way to make it working 
as expected: using an expert account with contact rewrite disabled and make 
asterisk side account force the nat helper to prevent calling loops it work. 
Thanks.

I've written a patch that add two little features i need as 2 new filters:

1- auto-answer with speaker enabled and remaining in background ( usefull to 
make callback from a website with a video you won't cover, in my case for a SIP 
based video citophone )

2- open an url if a specified callerid send it as unique body of a MESSAGE sip 
msg

Can those 2 be usefull and maybe if i send those features they can be added to 
trunk?

Original comment by antanisa...@gmail.com on 26 Apr 2011 at 2:40

GoogleCodeExporter commented 9 years ago
Yes of course you'll be welcome :). 
You can send it to developer mailing list or directly to me :).

Original comment by r3gis...@gmail.com on 26 Apr 2011 at 3:16