How to select channels depending on outgoing user

Hello,
im trying to get a pbx running on my raspi. So far, with one user, ist working pretty good-but i have one problem. To get calls out from a second user, i have to select his account. My Idea wa to do this with that:

exten => _0X./20,1,Verbose(Outgoing call via DTAG)
 same => _0X./20,n,Set(CALLERID(all)=callerid1)
 same => _0X./20,n,Dial(SIP/t-online.de-user1/${EXTEN:1},180,rg)
 same => _0X./20,n,Hangup

 exten => _0X./30,1,Verbose(Outgoing call via DTAG)
  same => _0X./30,n,Set(CALLERID(all)=callerid)
  same => _0X./30,n,Dial(SIP/t-online.de-user2/${EXTEN:1},180,rg)
  same => _0X./30,n,Hangup

Users are 20 and 30. So if user 20 is calling an external number, the first part of the context will be used, if user 30 is calling an external user, the second part of the context will be used.

But thats not working, because Asterisk can’t find the extension anymore using the /30 or /20 attribute on it. Before, without it, it worked perfectly fine.

try addig _
exten => _0X./_20,1

The preferred way of doing multiple tenant is with contexts.

The likely problem here is t-online are only using your IP address to distinguish between registered accounts.

1 Like

Thanks, that worked.