magnussolution / magnusbilling7

MagnusBilling is a fast, secure, efficient, high availability, VOIP Billing.
https://www.magnusbilling.org
GNU Lesser General Public License v3.0
174 stars 106 forks source link

Inbound Call Transfer is not successful using ALIAS number #368

Closed aliahanchi closed 3 years ago

aliahanchi commented 4 years ago

Hi Magnus team,

I would like to report and issue when transferring inbound call from a DID to other destination. Regardless of destination for a DID (SIP, Queue, Ring Group) the user which answered the call is not able to transfer to other users using the ALIAS number in SIP profile. Kindly check and assist to rectify the issue to improve the Magnus Billing.

aliahanchi commented 4 years ago

@magnussolution would you please advise if this issue can be solved anytime soon?

GabrielBragaGit commented 3 years ago

@magnussolution só para tentar ajudar segue codigo que eu introduzi no meu arquivo resources/mbilling.php que resolveu esse problema para o meu caso em particular. Eu digo que resolveu para o meu caso em particular pois todas as contas SIP no meu sistema tem um padrão de nomeclatura que segue é _, portanto se eu pegar o nome da conta SIP e explodir no '_' (underline) eu terei o meu ACCOUNTCODE na primeira posição do array, mas isso não valerá para todo mundo. Acredito que o correto seria fazer uma query na tabela 'pkg_sip' buscando pelo accountcode cujo name seja igual o da variavel $agi->request['agi_rdnis']. Coloquei uma validação antes de fazer essa consulta: if($MAGNUS->accountcode == "" && preg_match('/^Local/',$agi->request['agi_channel']))

Espero ter conseguido ajudar.

mbilling.php LINHA 228 if ($agi->get_variable("DIDACCOUNTCODE", true)) { $agi->verbose(25, "Get account code from trasnfered DID"); $MAGNUS->accountcode = $agi->get_variable("DIDACCOUNTCODE", true); }

//######## INICIO DO CODIGO PARA ACERTAR TRANSFERENCIA FEITA POR APARELHO SIP 302 MOVED TEMPORARILY ######## if($MAGNUS->accountcode == "" && preg_match('/^Local/',$agi->request['agi_channel'])) { $MAGNUS->accountcode = explode("_",$agi->request['agi_rdnis'])[0]; } //######## FIM DO CODIGO PARA ACERTAR TRANSFERENCIA FEITA POR APARELHO SIP 302 MOVED TEMPORARILY ########

$sql = "SELECT * FROM pkg_sip WHERE name = '$MAGNUS->dnid' OR (alias = '$MAGNUS->dnid' AND accountcode = '$MAGNUS->accountcode') LIMIT 1"; $MAGNUS->modelSip = $agi->query($sql)->fetch(PDO::FETCH_OBJ);