Asterisk has various ways of controlling how and when it stops the system. The options are similar to the restart commands. You can instruct Asterisk to stop only when there no longer any active channels, thus preventing calls from being dropped.
stop gracefully |
Stops the system when all currently active calls have completed, and does not accept new calls.
stop now |
Stops immediately, terminating all active calls.
stop when convenient |
Stops the system when all currently active calls have completed. New calls are accepted, and the system will stop only when there are no longer any active calls. Using this command is not a good idea, since you have no real way of knowing when the necessary condition for stopping the system will occur.
unload |
unload [-f -h] module_name
Unloads the specified module from Asterisk. The - f option causes the module to be unloaded even if it is in use (which may cause a crash), and the -h option causes the module to be unloaded even if the module says it cannot be, which will almost always cause a crash.
unload app_math.so