Update gateway.cpp

possible out of range fix
This commit is contained in:
Infactum 2021-12-16 20:03:36 +03:00 committed by GitHub
parent 99805b7db6
commit c45b30924c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -253,7 +253,7 @@ namespace state_machine::actions {
ctx.ext_phone = ext.substr(1, std::string::npos); ctx.ext_phone = ext.substr(1, std::string::npos);
} else if (is_digits(ext)) { } else if (is_digits(ext)) {
try { try {
ctx.user_id = std::stoi(ext); ctx.user_id = std::stol(ext);
} catch (const std::invalid_argument &e) { } catch (const std::invalid_argument &e) {
ext_valid = false; ext_valid = false;
} catch (const std::out_of_range &e) { } catch (const std::out_of_range &e) {
@ -906,4 +906,4 @@ void Gateway::process_event(const TSipEvent &event) {
delete *iter; delete *iter;
bridges.erase(iter); bridges.erase(iter);
} }
} }