Codec problem for inbound and outbound calls

So I have a trunk endpoint that I wanted to use for both inbound and outbound call but the problem is inbound and outbound requires different codecs.

For inbound i need to use:

allow=!all,ulaw,alaw

For outbound I use:

allow=!all,ulaw

is there a way I could fix this? or i need to use 2 different numbers for outbound and inbound calls? Thank you so much!

I think you can do it with two different endpoints, but with the caller ID of one matching the address of record of the other.

However, the requirement seems strange, so I wonder if there may be a misunderstanding, somewhere.

This is strange for me too…

when i call from linphone to the mobile number, it doesn’t want alaw but when i use that number to dial back asterisk, it needs alaw to work.

queues.conf

[general-support-mobile]
strategy=linear
member => PJSIP/11111@provider,,,PJSIP/provider 
member => PJSIP/11112@provider,,,PJSIP/provider

pjsip.conf

[provider]
type=aor
qualify_frequency=60
contact=sip:provider@example.com
[provider]
type=registration
transport=transport-udp
outbound_proxy=sip:111.111.111.111
outbound_auth=provider
retry_interval=60
fatal_retry_interval=30
forbidden_retry_interval=30
max_retries=10000
expiration=3600
auth_rejection_permanent=no
line=yes
endpoint=provider
server_uri=sip:example.com
client_uri=sip:provider@example.com
[provider]
type=identify
endpoint=provider
match=example.com
[provider]
type=endpoint
transport=transport-udp
context=provider
allow=!all,ulaw
aors=provider
language=en
outbound_auth=provider
user_eq_phone=no
t38_udptl=no
t38_udptl_ec=none
fax_detect=no
trust_id_inbound=no
t38_udptl_nat=no
direct_media=no
rtp_symmetric=yes
dtmf_mode=auto
fax_detect=no
trust_id_inbound=no
t38_udptl_nat=no
direct_media=no
rtp_symmetric=yes
rtp_keepalive=60
dtmf_mode=auto
from_domain=example.com
from_user=provider

extensions.conf

[from_internal]
exten => 6001,1,NoOp(call for Alice)
same => n,Dial(PJSIP/6001,20)
same => n,ExecIf($[ "${DIALSTATUS}" != "ANSWER" ]?Dial(PJSIP/11111@provider),1)
same => n,Hangup

exten => _0X.,1,NoOp(${EXTEN:1})
same => n,Goto(outgoing,${EXTEN:1},1)

[outgoing]
exten => _X.,1,Dial(PJSIP/${EXTEN}@provider)

can you please elaborate more on the solution? I don’t get this

the caller ID of one matching the address of record of the other.

One endpoint has a particular address only for outgoing, and the other endpoint has that same address, only for incoming purposes.

However, there is something missing here, as you are working around a problem that shouldn’t exist and I don’t see the detailed evidence that it is going wrong in this way. Is this by any chance really a continuation of another thread???

no… it’s not continuation of another thread… i really have this problem. maybe it’s something with my sip provider?

When i call from linphone to mobile, without alaw I got this:

[Mar  6 07:45:12] WARNING[645][C-0000003d]: channel.c:6638 ast_channel_make_compatible_helper: No path to translate from PJSIP/111111-00000099 to PJSIP/6001-00000098
[Mar  6 07:45:12] WARNING[645][C-0000003d]: app_dial.c:3273 dial_exec_full: Had to drop call because I couldn't make PJSIP/6001-00000098 compatible with PJSIP/111111-00000099

That looks like you haven’t loaded the correct translation module. Are you manually loading a minimal set of modules?

Yes… I only load a minimum set. Could you please tell me the necessary modules for translation?

You probably need codec_ulaw.so and codec_alaw.so. However, you should verify, with “core show translation” that you have a valid translation path, after loading them.

Note that, if you only operate in one part of the world, you should probably only be enabling the one of A-law and mu-law used in your country, throughout your network, as there is a small amount of information loss in transscoding from one to the other. Mu-law is typically used in the Americas and Japan, and A-law in the rest of the world.

Thank you so much! It works perfectly :blush: I hope my boss is pleased with this :stuck_out_tongue:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.