[Asterisk-code-review] res_pjsip_logger: Add method-based logging option. (asterisk[master])

Alexei Gradinari asteriskteam at digium.com
Fri Jul 22 09:06:00 CDT 2022


Attention is currently required from: N A.
Alexei Gradinari has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/18824 )

Change subject: res_pjsip_logger: Add method-based logging option.
......................................................................


Patch Set 1:

(3 comments)

File res/res_pjsip_logger.c:

https://gerrit.asterisk.org/c/asterisk/+/18824/comment/b04b2114_37bc696c 
PS1, Line 103: struct pjsip_method_logger {
> The methods included are the methods that PJSIP seems to natively support: https://www.pjsip. […]
Please look at res/res_pjsip.c to find out which methods asterisk PJSIP already supports

/* PJSIP doesn't know about the INFO method, so we have to define it ourselves */
static const pjsip_method info_method = {PJSIP_OTHER_METHOD, {"INFO", 4} };
static const pjsip_method message_method = {PJSIP_OTHER_METHOD, {"MESSAGE", 7} };

static struct {
        const char *method;
        const pjsip_method *pmethod;
} methods [] = {
        { "INVITE", &pjsip_invite_method },
        { "CANCEL", &pjsip_cancel_method },
        { "ACK", &pjsip_ack_method },
        { "BYE", &pjsip_bye_method },
        { "REGISTER", &pjsip_register_method },
        { "OPTIONS", &pjsip_options_method },
        { "SUBSCRIBE", &pjsip_subscribe_method },
        { "NOTIFY", &pjsip_notify_method },
        { "PUBLISH", &pjsip_publish_method },
        { "INFO", &info_method },
        { "MESSAGE", &message_method },
};


https://gerrit.asterisk.org/c/asterisk/+/18824/comment/cf9f6a31_02bff2d4 
PS1, Line 183: 	if (session->log_methods.log_method_invite && !pjsip_method_cmp(method, &pjsip_invite_method)) {
> Well, it does take it into consideration, it's just that it does an OR instead of an AND. […]
Where "existing logging mechanism uses an OR"? Do you mean host1 or host2 or host3?
I think it would be better to have AND condition for different filters: hosts and methods.
If I set both filters on hosts and methods I suppose that both filters are in effect. In your case I have to guess which one is in effect.


https://gerrit.asterisk.org/c/asterisk/+/18824/comment/8f770234_c9517d3e 
PS1, Line 443: 	memset(&default_logger->log_methods, 0, sizeof(default_logger->log_methods));
> I suppose that could be done, but then we'd have to check for starting with str, ending with it, or  […]
To be consistent with hosts filter I think would be better to have 2 commands:
"method" - to set only one method
"method add" - to add another method



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18824
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Idd03bd9b466b40e4bca7769437d52ac13a957cf9
Gerrit-Change-Number: 18824
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-Comment-Date: Fri, 22 Jul 2022 14:06:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: N A <mail at interlinked.x10host.com>
Comment-In-Reply-To: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220722/f764c013/attachment.html>


More information about the asterisk-code-review mailing list