Skip to content

Commit

Permalink
Pin based authentication - GO SDK changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Abinaya-Shunmugavel committed Jan 31, 2024
1 parent cc43e39 commit d09aac4
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 82 deletions.
36 changes: 23 additions & 13 deletions fixtures/createMaskingSessionResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,37 @@
"virtual_number": "916361728680",
"status": "active",
"initiate_call_to_first_party": false,
"session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
"callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
"callback_method": "GET",
"created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
"modified_time": "2023-07-05 16:33:08.444312 +0000 UTC",
"expiry_time": "2023-07-05 12:43:08.222701 +0000 UTC",
"duration": 8247,
"session_uuid": "fc145a33-778a-461f-af09-39438ca10fcf",
"callback_url": "",
"callback_method": "POST",
"created_time": "2024-01-25 12:00:00 +0000 UTC",
"modified_time": "2024-01-31 18:10:49 +0000 UTC",
"expiry_time": "2024-01-31 14:20:49 +0000 UTC",
"duration": 526848,
"amount": 0,
"call_time_limit": 14400,
"ring_timeout": 120,
"first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"ring_timeout": 45,
"first_party_play_url": "",
"second_party_play_url": "",
"record": false,
"record_file_format": "mp3",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_method": "GET",
"recording_callback_url": "",
"recording_callback_method": "POST",
"interaction": null,
"total_call_amount": 0,
"total_call_count": 0,
"total_call_billed_duration": 0,
"total_session_amount": 0,
"last_interaction_time": ""
"last_interaction_time": "",
"is_pin_authentication_required": true,
"generate_pin": false,
"generate_pin_length": 4,
"first_party_pin": 1234,
"second_party_pin": 1235,
"pin_prompt_play": "https://s3.amazonaws.com/plivosamplexml/pin_prompt_play_url.xml",
"pin_retry": 2,
"pin_retry_wait": 5,
"incorrect_pin_play": "https://s3.amazonaws.com/plivosamplexml/incorrect_play_url.xml",
"unknown_caller_play": "https://s3.amazonaws.com/plivosamplexml/unknown_play_url.xml"
}
}
36 changes: 23 additions & 13 deletions fixtures/getMaskingSessionResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,37 @@
"virtual_number": "916361728680",
"status": "active",
"initiate_call_to_first_party": false,
"session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
"callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
"callback_method": "GET",
"created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
"modified_time": "2023-07-05 10:25:40.877364 +0000 UTC",
"expiry_time": "2023-07-05 12:05:40.877364 +0000 UTC",
"duration": 6000,
"session_uuid": "fc145a33-778a-461f-af09-39438ca10fcf",
"callback_url": "",
"callback_method": "POST",
"created_time": "2024-01-25 12:00:00 +0000 UTC",
"modified_time": "2024-01-31 18:10:49 +0000 UTC",
"expiry_time": "2024-01-31 14:20:49 +0000 UTC",
"duration": 526848,
"amount": 0,
"call_time_limit": 14400,
"ring_timeout": 120,
"first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"ring_timeout": 45,
"first_party_play_url": "",
"second_party_play_url": "",
"record": false,
"record_file_format": "mp3",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_method": "GET",
"recording_callback_url": "",
"recording_callback_method": "POST",
"interaction": null,
"total_call_amount": 0,
"total_call_count": 0,
"total_call_billed_duration": 0,
"total_session_amount": 0,
"last_interaction_time": ""
"last_interaction_time": "",
"is_pin_authentication_required": true,
"generate_pin": false,
"generate_pin_length": 4,
"first_party_pin": 1234,
"second_party_pin": 1235,
"pin_prompt_play": "https://s3.amazonaws.com/plivosamplexml/pin_prompt_play_url.xml",
"pin_retry": 2,
"pin_retry_wait": 5,
"incorrect_pin_play": "https://s3.amazonaws.com/plivosamplexml/incorrect_play_url.xml",
"unknown_caller_play": "https://s3.amazonaws.com/plivosamplexml/unknown_play_url.xml"
}
}
40 changes: 25 additions & 15 deletions fixtures/updateMaskingSessionResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,37 @@
"virtual_number": "916361728680",
"status": "active",
"initiate_call_to_first_party": false,
"session_uuid": "7b5c5e17-e1e9-4ccd-a480-42f5c97fbe96",
"callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
"callback_method": "GET",
"created_time": "2023-07-06 10:53:32.814078 +0000 +0000",
"modified_time": "2023-07-06 10:53:45.106122 +0000 UTC",
"expiry_time": "2023-07-06 11:03:45.106117 +0000 UTC",
"duration": 612,
"session_uuid": "fc145a33-778a-461f-af09-39438ca10fcf",
"callback_url": "",
"callback_method": "POST",
"created_time": "2024-01-25 12:00:00 +0000 UTC",
"modified_time": "2024-01-31 18:10:49 +0000 UTC",
"expiry_time": "2024-01-31 14:20:49 +0000 UTC",
"duration": 526848,
"amount": 0,
"call_time_limit": 600,
"ring_timeout": 120,
"first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
"second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"record": true,
"call_time_limit": 14400,
"ring_timeout": 45,
"first_party_play_url": "",
"second_party_play_url": "",
"record": false,
"record_file_format": "mp3",
"recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
"recording_callback_method": "GET",
"recording_callback_url": "",
"recording_callback_method": "POST",
"interaction": null,
"total_call_amount": 0,
"total_call_count": 0,
"total_call_billed_duration": 0,
"total_session_amount": 0,
"last_interaction_time": ""
"last_interaction_time": "",
"is_pin_authentication_required": true,
"generate_pin": false,
"generate_pin_length": 4,
"first_party_pin": 1234,
"second_party_pin": 1235,
"pin_prompt_play": "https://s3.amazonaws.com/plivosamplexml/pin_prompt_play_url.xml",
"pin_retry": 2,
"pin_retry_wait": 5,
"incorrect_pin_play": "https://s3.amazonaws.com/plivosamplexml/incorrect_play_url.xml",
"unknown_caller_play": "https://s3.amazonaws.com/plivosamplexml/unknown_play_url.xml"
}
}
102 changes: 61 additions & 41 deletions maskingsession.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,69 @@ type MaskingSessionService struct {
}

type MaskingSession struct {
FirstParty string `json:"first_party,omitempty" url:"first_party,omitempty"`
SecondParty string `json:"second_party,omitempty" url:"second_party,omitempty"`
VirtualNumber string `json:"virtual_number,omitempty" url:"virtual_number,omitempty"`
Status string `json:"status,omitempty" url:"status,omitempty"`
InitiateCallToFirstParty bool `json:"initiate_call_to_first_party,omitempty" url:"initiate_call_to_first_party,omitempty"`
SessionUUID string `json:"session_uuid,omitempty" url:"session_uuid,omitempty"`
CallbackUrl string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
CallbackMethod string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
CreatedAt string `json:"created_time,omitempty" url:"created_time,omitempty"`
UpdatedAt string `json:"modified_time,omitempty" url:"updated_at,omitempty"`
ExpiryAt string `json:"expiry_time,omitempty" url:"expiry_time,omitempty"`
Duration int64 `json:"duration,omitempty" url:"duration,omitempty"`
SessionCreationAmount int64 `json:"amount" url:"amount"`
CallTimeLimit int64 `json:"call_time_limit,omitempty" url:"call_time_limit,omitempty"`
RingTimeout int64 `json:"ring_timeout,omitempty" url:"ring_timeout,omitempty"`
FirstPartyPlayUrl string `json:"first_party_play_url,omitempty" url:"first_party_play_url,omitempty"`
SecondPartyPlayUrl string `json:"second_party_play_url,omitempty" url:"second_party_play_url,omitempty"`
Record bool `json:"record,omitempty" url:"record,omitempty"`
RecordFileFormat string `json:"record_file_format,omitempty" url:"record_file_format,omitempty"`
RecordingCallbackUrl string `json:"recording_callback_url,omitempty" url:"recording_callback_url,omitempty"`
RecordingCallbackMethod string `json:"recording_callback_method,omitempty" url:"recording_callback_method,omitempty"`
Interaction []VoiceInteractionResponse `json:"interaction" url:"interaction"`
TotalCallAmount float64 `json:"total_call_amount" url:"total_call_amount"`
TotalCallCount int `json:"total_call_count" url:"total_call_count"`
TotalCallBilledDuration int `json:"total_call_billed_duration" url:"total_call_billed_duration"`
TotalSessionAmount float64 `json:"total_session_amount" url:"total_session_amount"`
LastInteractionTime string `json:"last_interaction_time" url:"last_interaction_time"`
FirstParty string `json:"first_party,omitempty" url:"first_party,omitempty"`
SecondParty string `json:"second_party,omitempty" url:"second_party,omitempty"`
VirtualNumber string `json:"virtual_number,omitempty" url:"virtual_number,omitempty"`
Status string `json:"status,omitempty" url:"status,omitempty"`
InitiateCallToFirstParty bool `json:"initiate_call_to_first_party,omitempty" url:"initiate_call_to_first_party,omitempty"`
SessionUUID string `json:"session_uuid,omitempty" url:"session_uuid,omitempty"`
CallbackUrl string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
CallbackMethod string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
CreatedAt string `json:"created_time,omitempty" url:"created_time,omitempty"`
UpdatedAt string `json:"modified_time,omitempty" url:"updated_at,omitempty"`
ExpiryAt string `json:"expiry_time,omitempty" url:"expiry_time,omitempty"`
Duration int64 `json:"duration,omitempty" url:"duration,omitempty"`
SessionCreationAmount int64 `json:"amount" url:"amount"`
CallTimeLimit int64 `json:"call_time_limit,omitempty" url:"call_time_limit,omitempty"`
RingTimeout int64 `json:"ring_timeout,omitempty" url:"ring_timeout,omitempty"`
FirstPartyPlayUrl string `json:"first_party_play_url,omitempty" url:"first_party_play_url,omitempty"`
SecondPartyPlayUrl string `json:"second_party_play_url,omitempty" url:"second_party_play_url,omitempty"`
Record bool `json:"record,omitempty" url:"record,omitempty"`
RecordFileFormat string `json:"record_file_format,omitempty" url:"record_file_format,omitempty"`
RecordingCallbackUrl string `json:"recording_callback_url,omitempty" url:"recording_callback_url,omitempty"`
RecordingCallbackMethod string `json:"recording_callback_method,omitempty" url:"recording_callback_method,omitempty"`
Interaction []VoiceInteractionResponse `json:"interaction" url:"interaction"`
TotalCallAmount float64 `json:"total_call_amount" url:"total_call_amount"`
TotalCallCount int `json:"total_call_count" url:"total_call_count"`
TotalCallBilledDuration int `json:"total_call_billed_duration" url:"total_call_billed_duration"`
TotalSessionAmount float64 `json:"total_session_amount" url:"total_session_amount"`
LastInteractionTime string `json:"last_interaction_time" url:"last_interaction_time"`
IsPinAuthenticationRequired bool `json:"is_pin_authentication_required" url:"is_pin_authentication_required"`
GeneratePin bool `json:"generate_pin" url:"generate_pin"`
GeneratePinLength int64 `json:"generate_pin_length" url:"generate_pin_length"`
FirstPartyPin int64 `json:"first_party_pin" url:"first_party_pin"`
SecondPartyPin int64 `json:"second_party_pin" url:"second_party_pin"`
PinPromptPlay string `json:"pin_prompt_play" url:"pin_prompt_play"`
PinRetry int64 `json:"pin_retry" url:"pin_retry"`
PinRetryWait int64 `json:"pin_retry_wait" url:"pin_retry_wait"`
IncorrectPinPlay string `json:"incorrect_pin_play" url:"incorrect_pin_play"`
UnknownCallerPlay string `json:"unknown_caller_play" url:"unknown_caller_play"`
}
type CreateMaskingSessionParams struct {
FirstParty string `json:"first_party,omitempty" url:"first_party,omitempty"`
SecondParty string `json:"second_party,omitempty" url:"second_party,omitempty"`
SessionExpiry int `json:"session_expiry" url:"session_expiry,omitempty"`
CallTimeLimit int `json:"call_time_limit,omitempty" url:"call_time_limit,omitempty"`
Record bool `json:"record,omitempty" url:"record,omitempty"`
RecordFileFormat string `json:"record_file_format,omitempty" url:"record_file_format,omitempty"`
RecordingCallbackUrl string `json:"recording_callback_url,omitempty" url:"recording_callback_url,omitempty"`
InitiateCallToFirstParty bool `json:"initiate_call_to_first_party,omitempty" url:"initiate_call_to_first_party,omitempty"`
CallbackUrl string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
CallbackMethod string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
RingTimeout int64 `json:"ring_timeout,omitempty" url:"ring_timeout,omitempty"`
FirstPartyPlayUrl string `json:"first_party_play_url,omitempty" url:"first_party_play_url,omitempty"`
SecondPartyPlayUrl string `json:"second_party_play_url,omitempty" url:"second_party_play_url,omitempty"`
RecordingCallbackMethod string `json:"recording_callback_method,omitempty" url:"recording_callback_method,omitempty"`
FirstParty string `json:"first_party,omitempty" url:"first_party,omitempty"`
SecondParty string `json:"second_party,omitempty" url:"second_party,omitempty"`
SessionExpiry int `json:"session_expiry" url:"session_expiry,omitempty"`
CallTimeLimit int `json:"call_time_limit,omitempty" url:"call_time_limit,omitempty"`
Record bool `json:"record,omitempty" url:"record,omitempty"`
RecordFileFormat string `json:"record_file_format,omitempty" url:"record_file_format,omitempty"`
RecordingCallbackUrl string `json:"recording_callback_url,omitempty" url:"recording_callback_url,omitempty"`
InitiateCallToFirstParty bool `json:"initiate_call_to_first_party,omitempty" url:"initiate_call_to_first_party,omitempty"`
CallbackUrl string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
CallbackMethod string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
RingTimeout int64 `json:"ring_timeout,omitempty" url:"ring_timeout,omitempty"`
FirstPartyPlayUrl string `json:"first_party_play_url,omitempty" url:"first_party_play_url,omitempty"`
SecondPartyPlayUrl string `json:"second_party_play_url,omitempty" url:"second_party_play_url,omitempty"`
RecordingCallbackMethod string `json:"recording_callback_method,omitempty" url:"recording_callback_method,omitempty"`
IsPinAuthenticationRequired bool `json:"is_pin_authentication_required" url:"is_pin_authentication_required"`
GeneratePin bool `json:"generate_pin" url:"generate_pin"`
GeneratePinLength int64 `json:"generate_pin_length" url:"generate_pin_length"`
FirstPartyPin int64 `json:"first_party_pin" url:"first_party_pin"`
SecondPartyPin int64 `json:"second_party_pin" url:"second_party_pin"`
PinPromptPlay string `json:"pin_prompt_play" url:"pin_prompt_play"`
PinRetry int64 `json:"pin_retry" url:"pin_retry"`
PinRetryWait int64 `json:"pin_retry_wait" url:"pin_retry_wait"`
IncorrectPinPlay string `json:"incorrect_pin_play" url:"incorrect_pin_play"`
UnknownCallerPlay string `json:"unknown_caller_play" url:"unknown_caller_play"`
}

type UpdateMaskingSessionParams struct {
Expand Down

0 comments on commit d09aac4

Please sign in to comment.