Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call Limit for Incoming #99

Open
tan2607 opened this issue Jan 10, 2025 · 6 comments
Open

Call Limit for Incoming #99

tan2607 opened this issue Jan 10, 2025 · 6 comments

Comments

@tan2607
Copy link

tan2607 commented Jan 10, 2025

Currently , the setting for Tiny phone only limit only 1 call for Manual Outbound only. Regarding Inbound or AMI call/3rd init call ( display as "INCOMING") not limit the number of call. Can we adding one more setting limit number of call for "INCOMING" call as well?
Thanks a lot!

@kingster
Copy link
Member

Call Limit is a configurable value since #94 This would be applicable even for INCOMING calls. Unless existing calls are terminated new call wouldn't be accepted as per pjsua docs.

@tan2607
Copy link
Author

tan2607 commented Feb 14, 2025

Sorry for the missing update and description. I will explain below:
Already setup maxCall = 1

  1. First call using channel originate ( AMI call) without any issue
dev-pbx*CLI> channel originate SIP/1005 extension 90389975034@from-internal
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Called 1005
    -- SIP/1005-00000008 is ringing
  1. Second call using AMI call still ringing but after that have the sound that your call had limit reach
= Using SIP RTP CoS mark 5
    -- Called 1005
    -- SIP/1005-0000000a is ringing
    -- SIP/1005-0000000a answered
    -- Executing [90704974701@from-internal:1] Macro("SIP/1005-0000000a", "user-callerid,LIMIT,EXTERNAL,") in new stack
    -- Executing [s@macro-user-callerid:1] Set("SIP/1005-0000000a", "TOUCH_MONITOR=1739517395.27") in new stack
    -- Executing [s@macro-user-callerid:2] Set("SIP/1005-0000000a", "CHANCONTEXT=") in new stack
    -- Executing [s@macro-user-callerid:3] Progress("SIP/1005-0000000a", "") in new stack
    -- Executing [s@macro-user-callerid:4] Set("SIP/1005-0000000a", "CHANCONTEXT=") in new stack
    -- Executing [s@macro-user-callerid:5] Set("SIP/1005-0000000a", "CHANEXTENCONTEXT=1005-0000000a") in new stack
    -- Executing [s@macro-user-callerid:6] Set("SIP/1005-0000000a", "CHANEXTEN=1005-0000000a") in new stack
    -- Executing [s@macro-user-callerid:7] Set("SIP/1005-0000000a", "CALLERID(number)=1005") in new stack
    -- Executing [s@macro-user-callerid:8] Set("SIP/1005-0000000a", "AMPUSER=1005") in new stack
    -- Executing [s@macro-user-callerid:9] Set("SIP/1005-0000000a", "HOTDESCKCHAN=1005-0000000a") in new stack
    -- Executing [s@macro-user-callerid:10] Set("SIP/1005-0000000a", "HOTDESKEXTEN=1005") in new stack
    -- Executing [s@macro-user-callerid:11] Set("SIP/1005-0000000a", "HOTDESKCALL=0") in new stack
    -- Executing [s@macro-user-callerid:12] ExecIf("SIP/1005-0000000a", "0?Set(HOTDESKCALL=1)") in new stack
    -- Executing [s@macro-user-callerid:13] ExecIf("SIP/1005-0000000a", "0?Set(CALLERID(name)=)") in new stack
    -- Executing [s@macro-user-callerid:14] GotoIf("SIP/1005-0000000a", "0?report") in new stack
    -- Executing [s@macro-user-callerid:15] ExecIf("SIP/1005-0000000a", "1?Set(REALCALLERIDNUM=1005)") in new stack
    -- Executing [s@macro-user-callerid:16] Set("SIP/1005-0000000a", "AMPUSER=1005") in new stack
    -- Executing [s@macro-user-callerid:17] GotoIf("SIP/1005-0000000a", "0?limit") in new stack
    -- Executing [s@macro-user-callerid:18] Set("SIP/1005-0000000a", "AMPUSERCIDNAME=Ext_1005") in new stack
    -- Executing [s@macro-user-callerid:19] ExecIf("SIP/1005-0000000a", "0?Set(__CIDMASQUERADING=TRUE)") in new stack
    -- Executing [s@macro-user-callerid:20] GotoIf("SIP/1005-0000000a", "0?report") in new stack
    -- Executing [s@macro-user-callerid:21] Set("SIP/1005-0000000a", "AMPUSERCID=1005") in new stack
    -- Executing [s@macro-user-callerid:22] Set("SIP/1005-0000000a", "__DIAL_OPTIONS=HhTtr") in new stack
    -- Executing [s@macro-user-callerid:23] Set("SIP/1005-0000000a", "CALLERID(all)="Ext_1005" <1005>") in new stack
    -- Executing [s@macro-user-callerid:24] ExecIf("SIP/1005-0000000a", "0?Set(CUSDIAL=)") in new stack
    -- Executing [s@macro-user-callerid:25] ExecIf("SIP/1005-0000000a", "0?Set(CALLERID(all)="Ext_1005" <1005>)") in new stack
    -- Executing [s@macro-user-callerid:26] GotoIf("SIP/1005-0000000a", "1?limit") in new stack
    -- Goto (macro-user-callerid,s,45)
    -- Executing [s@macro-user-callerid:45] Answer("SIP/1005-0000000a", "") in new stack
    -- Executing [s@macro-user-callerid:46] Wait("SIP/1005-0000000a", "1") in new stack
    -- Executing [s@macro-user-callerid:47] Gosub("SIP/1005-0000000a", "macro-user-callerid,lang-playback,1(hook_1)") in new stack
    -- Executing [lang-playback@macro-user-callerid:1] GosubIf("SIP/1005-0000000a", "1?macro-user-callerid,en,hook_1():macro-user-callerid,en,hook_1()") in new stack
    -- Executing [en@macro-user-callerid:3] Playback("SIP/1005-0000000a", "beep&im-sorry&your&simul-call-limit-reached&goodbye") in new stack

Can I request for the limit call can reject in the first time like this

dev-pbx*CLI> channel originate SIP/1005 extension 90704974701@from-internal
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
[2025-02-14 14:22:53] NOTICE[45562]: chan_sip.c:6941 update_call_counter: Call to peer '1005' rejected due to usage limit of 1

Thank a lot!

@kingster
Copy link
Member

kingster commented Feb 14, 2025

As per pjsip documentation and even the code, additional call invites are rejected.

https://github.com/pjsip/pjproject/blob/e533af23c19d65496b8a8016a531bcd24899800c/pjsip/src/pjsua-lib/pjsua_call.c#L2800-L2812

PJ_DEF(pj_status_t) pjsua_call_answer2(pjsua_call_id call_id,
                                       const pjsua_call_setting *opt,
                                       unsigned code,
                                       const pj_str_t *reason,
                                       const pjsua_msg_data *msg_data)
{
    pjsua_call *call;
    pjsip_dialog *dlg = NULL;
    pjsip_tx_data *tdata;
    pj_status_t status;


    PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls,
                     PJ_EINVAL);

This line what you are referring is probably from your PBX call stack and not being generated by tinyphone.

    -- Executing [en@macro-user-callerid:3] Playback("SIP/1005-0000000a", "beep&im-sorry&your&simul-call-limit-reached&goodbye") in new stack

Can you share the tinyphone logs (which has the sip exchange for this second call?) that would have what is exactly happening in the 2nd call from tinyphone point.

@tan2607
Copy link
Author

tan2607 commented Feb 14, 2025

Thank for your response, please check the log in the attached file
14-02-2025-tinyphone.log
There is no reject in the log.
Maybe we using chan_sip instead of pjsip that the cause not work as expected

@kingster
Copy link
Member

kingster commented Feb 14, 2025

What is the config that is being used ? Can you share output of ip:6060/config ?

Default config allows 4 calls

@tan2607
Copy link
Author

tan2607 commented Feb 14, 2025

Sure, below is my config when login via address : localhost:6060/config?

{
  "config": {
    "audioCodecs": [
      "PCMA/8000/1",
      "PCMU/8000/1",
      "G729/8000/1"
    ],
    "autoAnswer": true,
    "autoAnswerDelay": 1000,
    "autoDeviceRefresh": true,
    "autoUnHold": true,
    "clockRate": 8000,
    "deviceErrorAlert": true,
    "disableVAD": true,
    "dropCallsOnFail": false,
    "ecTailLen": 200,
    "enableICE": false,
    "enableMetrics": false,
    "enableNoiseCancel": false,
    "enableSTUN": false,
    "enableWSEvents": true,
    "firstRetryIntervalSec": 15,
    "handleNOTIFY": true,
    "maxAccounts": 3,
    "maxCalls": 1,
    "metricsProto": "UDP",
    "metricsServerHosts": [
      "127.0.0.1"
    ],
    "metricsServerPort": 8125,
    "persistAccounts": true,
    "pjLogLevel": 4,
    "pjMediaThreadCount": 4,
    "pjThreadCount": 2,
    "prefferedAudioDevices": [
      "sound",
      "usb",
      "headphone",
      "audio",
      "microphone",
      "speakers"
    ],
    "refreshIntervalSec": 120,
    "retryIntervalSec": 30,
    "securityCode": "D9C853F4897CF64307DB652246827FAC83111303F3E207F8FD9F5E5DC89A9EF9",
    "stunServers": [
      "stun.l.google.com:19302"
    ],
    "testAudioDevice": true,
    "timeoutSec": 600,
    "transport": 1,
    "uaPrefix": "TinyPhone Pjsua2 v",
    "unregisterOnDeviceError": true,
    "useDefaultAudioDevice": true
  },
  "http-log-file": "C:\\Users\\NY-HCM~1\\AppData\\Local\\Temp\\tinyphone\\14-02-2025-tinyphone-http.log",
  "sip-log-file": "C:\\Users\\NY-HCM~1\\AppData\\Local\\Temp\\tinyphone\\14-02-2025-tinyphone.log",
  "version": "36.0.0.84"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants