[SR-Users] 403 Forbidden

Pejic, Miroslav miroslav.pejic at cloud.timenet.it
Fri Jun 14 16:59:38 CEST 2019


Hi Federico,

i tryied also with `modparam("acc", "cdr_on_failed", 1)`
but in my case the call is not saved at all on `acc_cdrs`,
with the second method i mentioned works :)
Thanks
Miro

Il giorno ven 14 giu 2019 alle ore 16:14 Federico Cabiddu <
federico.cabiddu at gmail.com> ha scritto:

> Hi,
> dialog CDR for failed calls can be generated enabling
>
> http://www.kamailio.org/docs/modules/devel/modules/acc.html#acc.p.cdr_on_failed
>
> It has been some time since I last tested it, but it still should work :)
>
> Cheers,
>
> Federico
>
> On Fri, Jun 14, 2019 at 3:25 PM Daniel-Constantin Mierla <
> miconda at gmail.com> wrote:
>
>> Hello,
>>
>> it should be ok also with 2) if it gives what you want. Kamailio is just
>> writing to acc_cdrs, if you have extra columns, it should not be affected.
>>
>> Cheers,
>> Daniel
>> On 14.06.19 14:16, Pejic, Miroslav wrote:
>>
>> Hi Daniel :)
>>
>> i tryied 2 methods to save it
>>
>> 1) i created a new table on kamailio_router called `acc`
>>
>> from `utils/kamctl/mysql/acc-create.sql`
>>
>> ```
>> CREATE TABLE `acc` (
>>     `id` INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
>>     `method` VARCHAR(16) DEFAULT '' NOT NULL,
>>     `from_tag` VARCHAR(128) DEFAULT '' NOT NULL,
>>     `to_tag` VARCHAR(128) DEFAULT '' NOT NULL,
>>     `callid` VARCHAR(255) DEFAULT '' NOT NULL,
>>     `sip_code` VARCHAR(3) DEFAULT '' NOT NULL,
>>     `sip_reason` VARCHAR(128) DEFAULT '' NOT NULL,
>>     `time` DATETIME NOT NULL
>> );
>> CREATE INDEX callid_idx ON acc (`callid`);
>> ```
>> then
>>
>> ```
>> route[IS_CALLER_BLACKLISTED] {
>>
>>   python_exec("check_caller_blacklisted");
>>
>>   if ($var(callerBlacklisted) == 1){
>>
>>      t_send_reply("403", "Forbidden");
>>
>>      acc_db_request("403 Forbidden", "acc");
>>
>>      exit;
>>
>>   }
>>
>> ```
>>
>> in `acc` i have now calls that were not answered with 200ok :)
>>
>>
>> 2) add new fields on exsisting acc_cdrs table used to store cdrs
>>
>> ```
>> ALTER TABLE `acc_cdrs` ADD COLUMN `from_tag` varchar(128) DEFAULT NULL
>> AFTER `dst_domain`;
>> ALTER TABLE `acc_cdrs` ADD COLUMN `to_tag` VARCHAR(128) DEFAULT NULL
>> AFTER `from_tag`;
>> ALTER TABLE `acc_cdrs` ADD COLUMN `sip_code` VARCHAR(3) DEFAULT NULL
>> AFTER `to_tag`;
>> ALTER TABLE `acc_cdrs` ADD COLUMN `sip_reason` varchar(128) DEFAULT NULL
>> AFTER `sip_code`;
>> ALTER TABLE `acc_cdrs` ADD COLUMN `time` datetime DEFAULT NULL AFTER
>> `sip_reason`;
>> ```
>>
>> ```
>> route[IS_CALLER_BLACKLISTED] {
>>
>>   python_exec("check_caller_blacklisted");
>>
>>   if ($var(callerBlacklisted) == 1){
>>
>>      t_send_reply("403", "Forbidden");
>>
>>      acc_db_request("403 Forbidden", "acc_cdrs");
>>
>>      exit;
>>
>>   }
>>
>> ```
>>
>> In this way i have both stored calls that were not answered with 200ok
>> and that were answered with 200ok.
>> The idea is to have all in one table `acc_cdrs`.
>>
>> Can be ok also the second solution?
>>
>> Thank you very much!
>> Miro
>>
>> Il giorno ven 14 giu 2019 alle ore 09:06 Daniel-Constantin Mierla <
>> miconda at gmail.com> ha scritto:
>>
>>> Hello,
>>>
>>> I don't think that you can get a dialog-based CDR for calls that were
>>> not answered with 200ok. But you can get a record in acc table, by storing
>>> failed transaction record (see the mod params for acc and failed
>>> transaction flag or use acc_db_request()).
>>>
>>> Cheers,
>>> Daniel
>>> On 13.06.19 22:45, Pejic, Miroslav wrote:
>>>
>>> Hi :)
>>>
>>>
>>> I'm trying to save a failed call in the kamailio_router.acc_cdrs
>>> database
>>>
>>> after sending the 403 Forbidden by router, using the module acc, if is
>>> it possible?
>>>
>>>
>>> https://www.kamailio.org/docs/modules/5.2.x/modules/acc.html
>>>
>>>
>>> Something like this:
>>>
>>>
>>> route[IS_CALLER_BLACKLISTED] {
>>>
>>>
>>>   python_exec("check_caller_blacklisted");
>>>
>>>
>>>   if ($var(callerBlacklisted) == 1){
>>>
>>>
>>>      t_send_reply("403", "Forbidden");
>>>
>>>
>>>   IT’S POSSIBLE HERE SAVE A CALL ON KAMAILIO_ROUTER.ACC_CDRS?
>>>
>>>
>>>
>>>   exit;
>>>
>>>   }
>>>
>>>
>>> Thanks in advance!
>>>
>>> Miro
>>>
>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing Listsr-users at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>> --
>>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>
>>> --
>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190614/d877bbce/attachment.html>


More information about the sr-users mailing list