i have one sip trunk and many DIDs numebrs in OVH , i afected every DID number to an extension by creating a trunk sip and inbound route for each number and in ovh interface i redirected all traffic to trunk. i have no problem with outbound calls but inbound calls sometimes works and sometimes not and sometimes an incoming call ring in different extensions in the same time .
Asterisk will only use the first matching definition. Hopefully it will use a type=peer match, and type=peer is likely to be more secure, but there is nothing in your trunk definitions about the user part of the request URI, so Asterisk only has the IP address to go on and will use the “first” section that matches on that. First refers to the position in the internal data structures and may not reflect the order in the file.
That basically means you have to discriminate based on the Asterisk extension that appears in the incoming request.
In a traditional, analogue, or ISDN, system, you would have a single trunk that was shared across all your incoming numbers. (Although I doubt that direct in dialling is still offered on analogue connections.)
Note that username= was deprecated in favour of defaultuser=, a long time ago, probably because it was misleading people to think it had a role for incoming calls.
after disabling all the trunks and keep one trunk running . incoming calls workd but they rings in all extensions in first try and after rebooting asterisk no incoming call works now
yes , the trunk is registred . now it works when i add a DID number in the end of the Recording string but when calling all the other DIDs the all ring in the extension linked to the DID number add to the recording string
As @sorvani said, change the context for the trunk to from-pstn-toheader
Set up an Inbound Route with DID and CID left blank (ANY/ANY). Call in and see what appears in the CDR DID field. Set up your Inbound Routes with DID in the same format.
Hello , i changed my conf to pjsip trunk as @sorvani and @Stewart1 saggested … in coming calls works but and if i calls the dids they rings in the disered extensions but this just works just for a while after that when you call the DIDs it rings but not in the extensions but when i reboot it work … outbond calls dont work … what can i do … thanks in advance .
If it works after a restart then quits after a while there is something in your config. Most likely lower the registration time of the the trunk In the advanced pjsip settings tab.
its wooooorks …thank you all so much …the PJSIP Trunk suggested by @sorvani and the setting experation from @Stewart1 saved the day … thank you guys