Assistance with Authentication

Discussion in 'Call Flow Designer' started by leonp, Jan 21, 2018.

Thread Status:
Not open for further replies.
  1. leonp

    Joined:
    Jan 21, 2018
    Messages:
    37
    Likes Received:
    2
    Hi,

    I am currently evaluating 3CX and trying to build an authentication piece to prove that 3CX can provide the functionality that we need.

    I'm having trouble with the validation part currently. (I'm pretty much using this -> https://www.3cx.com/docs/cfd-validate-customers/)

    I managed to grab this part of a log file, where I can see that my "responseContent" appears to equal 1


    18/01/21 22:58:01.079|100049| Trc|75|0017|: PlugIn[SDP_Queue - WebInteractionComponent - CallID AFMDARSEUPEB] Trace: Start executing component with uri='http://test.domain.com/validate' - httpMethod='POST' - contentType='application/json' - content'{"id":"5852","pin":""}'
    18/01/21 22:58:01.105|100049| Trc|75|0019|: PlugIn[SDP_Queue - WebInteractionComponent - CallID AFMDARSEUPEB] Trace: End executing component with responseStatusCode='200' - responseContent: 1

    18/01/21 22:58:01.105|100049| Trc|75|0017|: PlugIn[SDP_Queue - SequenceContainer 'authenticateCallerRequestId_Conditional_ValidInput' - CallID AFMDARSEUPEB] Trace: Start executing component 'checkValidationResult'
    18/01/21 22:58:01.105|100049| Trc|75|0017|: PlugIn[SDP_Queue - SequenceContainer 'checkValidationResult_1' - CallID AFMDARSEUPEB] Trace: Start executing component 'PromptPlayback2'
    18/01/21 22:58:01.105|100049| Trc|75|0017|: PlugIn[SDP_Queue - TextToSpeechAudioPrompt - CallID AFMDARSEUPEB] Trace: Generating text to speech to fileName='/var/lib/3cxpbx/Instance1/Data/Ivr/Prompts/../../Voiceapps/SDP_Queue/Audio/Temp_11.wav' for text='pin number could not be validated'​

    The condition for successful validation is -> EQUAL(validateCustomer.ResponseContent,"1")

    However, the user is not being validated, instead falling into the non validated branch.

    Am I possibly missing something obvious?

    Thanks,

    Leon
     
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,058
    Likes Received:
    75
    Hello Leon,

    It seems that the value returned by the web service has a trailing new line character. Try using the TRIM function to remove any leading or trailing non visible character before comparing it.

    Kind regards.
    Ernesto.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. leonp

    Joined:
    Jan 21, 2018
    Messages:
    37
    Likes Received:
    2
    Thanks for the suggestion - I tried the following to no avail...

    EQUAL(TRIM(validateCustomer.ResponseContent),"1")

    Anything else I could look at?
     
  4. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,058
    Likes Received:
    75
    Hello @leonp,

    Weird, can you use a Logger component to log the following expression?
    CONCATENATE("Response is '",TRIM(validateCustomer.ResponseContent),"'")

    Then check what you have in the log. This way you log the result between quotes, and you see exactly what you have there.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. leonp

    Joined:
    Jan 21, 2018
    Messages:
    37
    Likes Received:
    2
    Ok - that helped me get to the bottom of the problem. In the end, I think it was the TRIM function which fixed it, but I had made a couple of other changes which I needed to reverse.

    Is it possible to return JSON and have each returned variable available for use? (For example - REST API returns a customer name, which could be set as the FROM name in the SIP header, to be carried through as the caller ID?)
     
  6. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,058
    Likes Received:
    75
    Glad to know that the issue has been solved.

    You can use JSON, XML, or whatever format you need. If you use JSON, you can use the Newtonsoft.Json.dll, which is already part of the 3CX installation, to parse the JSON and split it as you need.

    Regarding changing the display name, currently it's not possible, but we will be adding that feature in the near future.

    Kind regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. leonp

    Joined:
    Jan 21, 2018
    Messages:
    37
    Likes Received:
    2
    Thanks for the help.

    Changing incoming caller ID would be very helpful.

    We also provide different levels of out of hours service, so the level of service returned via the API would be appropriate for time controls.

    Regards,

    Leon
     
  8. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,058
    Likes Received:
    75
    You can use that level of service returned by the API without any problem...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.